flutter_app_update_manager 0.0.1
flutter_app_update_manager: ^0.0.1 copied to clipboard
A Flutter package to easily manage in-app updates using Firebase Firestore.
Flutter App Update Manager #
A Flutter package to easily manage in-app updates using Firebase Firestore.
Features #
- Automatic Update Checks: Automatically checks for new app versions from Firebase Firestore.
- Customizable Update Dialog: Easily customize the update dialog to match your app's UI.
- Force and Optional Updates: Configure updates to be either mandatory (force update) or optional.
- Platform-Specific Configuration: Separate update configurations for Android and iOS.
- Discontinued Versions Support: Notify users of discontinued app versions and prompt them to update.
Getting Started #
Prerequisites #
- Flutter installed on your machine.
- A Flutter project with Firebase configured.
Installation #
Add the following to your pubspec.yaml
file:
dependencies:
flutter_app_update_manager: ^1.0.0 # Replace with the latest version
Then, run flutter pub get
.
Usage #
Firebase Firestore Setup #
- Go to your Firebase project console and create a Firestore database.
- Create a collection named
AppUpdateManager
. - Inside the
AppUpdateManager
collection, create two documents:Android
andIos
.
Document Structure
For Android:
- Collection:
AppUpdateManager
- Document:
Android
- Field:
versions
(Array of maps)version
:String
(e.g., "1.0.0+1")forceUpdate
:Boolean
(true/false)
- Field:
discontinuedVersions
(Array of strings)
- Field:
- Document:
For iOS:
- Collection:
AppUpdateManager
- Document:
Ios
- Field:
versions
(Array of maps)version
:String
(e.g., "1.0.0+1")forceUpdate
:Boolean
(true/false)
- Field:
discontinuedVersions
(Array of strings)
- Field:
- Document:
Implementation #
In your app, import the package and initialize the AppUpdateManager
in your initState
or any other suitable place:
import 'package:flutter_app_update_manager/flutter_app_update_manager.dart';
@override
void initState() {
super.initState();
AppUpdateManager(
context: context,
androidId: 'your.android.app.id',
iosId: 'your.ios.app.id',
).checkForUpdate();
}
Customization #
You can customize the update dialog by passing additional parameters to the AppUpdateManager
constructor:
AppUpdateManager(
context: context,
androidId: 'your.android.app.id',
iosId: 'your.ios.app.id',
showLaterButton: true, // Show a "Later" button for optional updates
appName: 'My Awesome App', // Your app's name
playStoreUrl: 'https://play.google.com/store/apps/details?id=your.android.app.id', // Custom Play Store URL
appStoreUrl: 'https://apps.apple.com/app/id-your.ios.app.id', // Custom App Store URL
).checkForUpdate();
Example #
For a complete example, please see the /example
folder in this package.
Additional Information #
- Contributing: Contributions are welcome! Please feel free to submit a pull request.
- Issues: If you find any issues or have a feature request, please file an issue on our GitHub repository.
- License: This package is licensed under the MIT License.