{"id":22413541,"url":"https://github.com/nextfaze/flutter_manup","last_synced_at":"2025-07-31T23:31:25.031Z","repository":{"id":38469246,"uuid":"163801686","full_name":"NextFaze/flutter_manup","owner":"NextFaze","description":"Mandatory Update for Flutter Apps","archived":false,"fork":false,"pushed_at":"2024-09-20T05:09:36.000Z","size":380,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-16T03:27:17.130Z","etag":null,"topics":["android","dart","flutter","flutter-package","ios","widget"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/manup","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NextFaze.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-02T06:14:23.000Z","updated_at":"2024-09-20T05:09:07.000Z","dependencies_parsed_at":"2024-11-16T03:26:13.184Z","dependency_job_id":"06f17094-a0af-4e22-ae16-835ec8079dc9","html_url":"https://github.com/NextFaze/flutter_manup","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Fflutter_manup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Fflutter_manup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Fflutter_manup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextFaze%2Fflutter_manup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NextFaze","download_url":"https://codeload.github.com/NextFaze/flutter_manup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228312126,"owners_count":17900219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dart","flutter","flutter-package","ios","widget"],"created_at":"2024-12-05T14:13:22.959Z","updated_at":"2024-12-05T14:13:26.554Z","avatar_url":"https://github.com/NextFaze.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ManUp\n\n*Man*datory *Up*dates for Flutter\n\n[![pub package](https://img.shields.io/pub/v/manup.svg)](https://pub.dartlang.org/packages/manup) [![Build Status](https://travis-ci.org/NextFaze/flutter_manup.svg?branch=master)](https://travis-ci.org/NextFaze/flutter_manup) [![Coverage Status](https://coveralls.io/repos/github/NextFaze/flutter_manup/badge.svg?branch=master)](https://coveralls.io/github/NextFaze/flutter_manup?branch=master)\n\n![image](./example.gif)\n\nSometimes you have an app which talks to services in the cloud. Sometimes,\nthose services change, and your app no longer works. Wouldn't it be great if\nthe app could let the user know there's an update? That's what this module\ndoes.\n\n## Usage\n\nYou can select the method to store and fetch app config file with the following options\n\n- HTTP (`HttpManUpService`)\n  - you need a hosted json file that contains the version metadata. This _could_ be part of your API. However,\n    often the reason for maintenance mode is because your API is down. An s3 bucket may be a safer bet,\n    even though it means a little more work in maintaining the file.\n- Firebase remote config (`FireBaseRemoteConfigManUpService`)\n  - you need to setup firebase project and remote config, then [Add Firebase to your Flutter app](https://firebase.google.com/docs/flutter/setup?platform=ios).\n\nApp config file structure\n\n```json\n{\n  \"ios\": {\n    \"latest\": \"2.4.1\",\n    \"minimum\": \"2.1.0\",\n    \"url\": \"http://example.com/myAppUpdate\",\n    \"enabled\": true\n  },\n  \"android\": {\n    \"latest\": \"2.5.1\",\n    \"minimum\": \"2.1.0\",\n    \"url\": \"http://example.com/myAppUpdate/android\",\n    \"enabled\": true\n  }\n}\n```\n\n- `\"ios\" or \"android : \u003cstring\u003e` - device operating system\n- `latest : \u003cstring\u003e` - the latest application version - running a lower version prompts to update (based on `url`)\n- `minimum : \u003cstring\u003e` - the minimum required application version - running a lower version prevents the app from running (prompting to update based on `url`)\n- `url : \u003cstring\u003e` - url of where to download application update\n- `enabled : \u003cbool\u003e` - whether or not the application is enabled - `false` completely prevents app use\n\nIf `\"ios\"` or `\"android\"` configurations are omitted, it will treat the device as having the latest version of the app installed.\n\n### Using the Service Directly\n\nYou can use service directly in your code. As part of your app startup logic, use the service to validate the running version.\n\n- `HttpManUpService`\n\n  ```dart\n  HttpManUpService service = HttpManUpService('https://example.com/manup.json', client: http.Client());\n  ManUpStatus result = await service.validate();\n  service.close();\n  ```\n\n- `FireBaseRemoteConfigManUpService`\n\n  ```dart\n  FireBaseRemoteConfigManUpService service = FireBaseRemoteConfigManUpService(\n      remoteConfig: FirebaseRemoteConfig.instance,\n      // Parameter name (key) in remote config\n      paramName: 'configName',\n    );\n  ManUpStatus result = await service.validate();\n  service.close();\n  ```\n\n`ManUpStatus` will let you know how the version of the app running compares to the metadata:\n\n- `latest`: The app is the latest version\n- `supported`: The app is a supported version, but not the latest\n- `unsupported`: The app is an unsupported version and should not run\n- `disabled`: The app has been marked as disabled and should not run\n\n### Fetching other Settings and Feature Flags\n\nYou may want to have other remote configuration in your ManUp file - such as\nfeature flags. To fetch these settings you can use\n`service.setting(key:'myKey')` after successfully running `validate()` to load\nthe config from the json file. By default, ManUp will look to the the current os\nfor the key and fallback to the root:\n\n```json\n{\n  \"ios\": {\n    \"latest\": \"2.4.1\",\n    // ... other config\n    \"myFeatureEnabled\": true // \u003c- used on iOS\n  },\n  \"myFeatureEnabled\": false // \u003c- Fallback used for other platforms\n}\n```\n\n```dart\n// In this case will be `true` on iOS and `false` on Android/Web etc.\nfinal enableMyFeature = service.setting\u003cbool\u003e(key: 'myFeatureEnabled',\n// fallback value if getter fails for some reason\n  orElse: false);\n```\n\n### Using the Service with Delegate\n\nImplement `ManUpDelegate` or use `ManUpDelegateMixin` mixin which has default implementation.\n\n- `manUpConfigUpdateStarting()` : will be called before starting to validate\n- `manUpStatusChanged(ManUpStatus status)` : will be called every time status changes\n- `manUpUpdateAvailable()` : will be called when ManUpStatus changes to supported\n- `manUpUpdateRequired()` : will be called when ManUpStatus changes to unsupported\n- `manUpMaintenanceMode()`: will be called when ManUpStatus changes to disabled\n\n### Using the Service with Helper Widget\n\nWrap your widget with `ManUpWidget` to automatically handle every thing.\n\n```dart\n@override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: ManUpWidget(\n          service: manUpService,\n          shouldShowAlert: () =\u003e true,\n          onComplete: (bool isComplete) =\u003e print(isComplete),\n          onError: (dynamic e) =\u003e print(e.toString()),\n          child: Container()),\n    );\n  }\n```\n\n### Exception Handling\n\n`validate` will throw a `ManUpException` if the lookup failed for any reason. Most likely, this will be caused\nby the device being offline and unable to retrieve the metadata. It is up to you how you want to handle this in your app. Some apps, where a supported version is critical, should probably not run unless the version was validated successfully. However, for other apps, there's probably no problem and the app should continue running.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextfaze%2Fflutter_manup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextfaze%2Fflutter_manup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextfaze%2Fflutter_manup/lists"}