A Flutter package for automatic app updates via Firebase Firestore and GitHub releases.
- � Fetch updates from Firebase Firestore
- 📥 Download APK from GitHub releases
- 📲 Install updates automatically
- 🎨 Beautiful update bottom sheet UI
- ⚡ Progress tracking for downloads
Add to your pubspec.yaml:
dependencies:
firebase_github_updater: ^0.0.1
firebase_core: ^3.0.0
cloud_firestore: ^5.0.0- Initialize Firebase in your app:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}- Create Firestore collection
app_releaseswith documents:
{
"package_name": "com.example.app",
"app_name": "My App",
"version": "1.0.1",
"build_number": 2,
"release_notes": "Bug fixes and improvements",
"downloads": [
{
"platform": "android",
"type": "apk",
"url": "https://github.com/user/repo/releases/download/v1.0.1/app.apk",
"filename": "app.apk",
"size": 25000000
}
]
}import 'package:firebase_github_updater/firebase_github_updater.dart';
// Just call this - it handles everything automatically!
await FirebaseGithubUpdaterHelper.checkAndShowUpdate(
context: context,
collectionName: 'app_releases',
packageName: 'com.example.app',
currentVersion: '1.0.0',
currentBuildNumber: 1,
onUpdateComplete: () {
print('Update completed!');
},
);import 'package:firebase_github_updater/firebase_github_updater.dart';
// Check for updates manually
final updater = FirebaseUpdaterService(
collectionName: 'app_releases',
currentVersion: '1.0.0',
currentBuildNumber: 1,
packageName: 'com.example.app',
);
final update = await updater.checkForUpdate();
if (update != null) {
// Show bottom sheet
UpdateBottomSheet.show(context, update);
// Or use download/install services directly
final downloadService = DownloadService();
final installService = InstallService();
}Collection: app_releases
Required fields:
package_name(String) - Your app's package nameapp_name(String) - Display nameversion(String) - Version like "1.0.1"build_number(int) - Build number for comparisondownloads(Array) - Download assets
Optional fields:
release_notes(String)description(String)icon_url(String)screenshots(Array)
Add to AndroidManifest.xml:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.INTERNET" />