update_manager 1.0.0
update_manager: ^1.0.0 copied to clipboard
A Flutter package for managing app updates
update_manager #
A Flutter package for managing app updates with Firebase Remote Config.
It helps you implement force updates and optional updates easily, so users always stay on the right app version.
β¨ Features #
- π Force update when a critical version is required
- π’ Optional update when a newer version is available
- π§ Configurable via Firebase Remote Config
- π― Simple integration with callback support
- π οΈ Example app included
π¦ Installation #
Add this to your pubspec.yaml
:
dependencies:
update_manager: ^1.0.0
Run:
flutter pub get
π Usage #
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:update_manager/update_manager.dart';
class UpdateExampleWidget extends StatefulWidget {
const UpdateExampleWidget({super.key});
@override
State<UpdateExampleWidget> createState() => _UpdateExampleWidgetState();
}
class _UpdateExampleWidgetState extends State<UpdateExampleWidget> {
late final RemoteConfigService _remoteService;
UpdateType _updateType = UpdateType.none;
@override
void initState() {
super.initState();
_initializeUpdateService();
}
Future<void> _initializeUpdateService() async {
final packageInfo = await PackageInfo.fromPlatform();
_remoteService = RemoteConfigService(
packageInfo: packageInfo,
onUpdate: (type) {
setState(() {
_updateType = type;
});
switch (type) {
case UpdateType.force:
// Show force update dialog
break;
case UpdateType.optional:
// Show optional update suggestion
break;
case UpdateType.none:
// No update available
break;
}
},
);
await _remoteService.initialiseAndCheck();
}
@override
Widget build(BuildContext context) {
return Center(
child: Text('Update Status: $_updateType'),
);
}
}
βοΈ Firebase Setup #
- Enable Remote Config in Firebase Console
- Add these default parameters:
Key | Example Value | Description |
---|---|---|
min_required_version |
1.0.0 |
Minimum app version allowed |
latest_version |
1.1.0 |
Latest available version |
π± Example #
See the example/
folder for a full demo project.
Future Enhancements #
- Planned integration with Shorebird for patch updates.
π License #
This project is licensed under the MIT License.