A Flutter application demonstrating automatic app updates via GitHub Releases for Android devices.
✨ Automatic Update Checks - Checks for new versions on app launch
📥 GitHub Integration - Fetches releases from GitHub API
🔐 Private Repository Support - Optional token authentication for private repos
📝 Markdown Release Notes - Beautifully formatted release notes with full markdown support
📊 Progress Tracking - Real-time download progress indicator
🔒 Secure Installation - FileProvider support for Android 7.0+
🎨 Material 3 UI - Modern, clean update dialog
⚡ MethodChannel - Native Android integration for reliable APK installation
Edit lib/cores/constants/github_references.dart:
class GitHubReferences {
static const String owner = 'your_username'; // Your GitHub username
static const String repo = 'your_repo_name'; // Your repository name
static const String apkKey = 'prod'; // APK filename filter, if empty it will pick first apk file on release
static const String token = ''; // GitHub token (optional, for private repos)
}Note
For public repositories, leave the token field as an empty string.
For private repositories, provide a GitHub Personal Access Token with repo scope.
# Tag your release
git tag v1.0.0
git push origin v1.0.0
# Build APK
flutter build apk --release
# Upload to GitHub
# Go to Releases → Create new release → Upload APKflutter pub get
flutter run- Launch: App checks if running on Android
- Version Check: Queries GitHub Releases API for latest version
- Comparison: Compares current version with server version
- Dialog: Shows update prompt if newer version exists
- Download: Downloads APK with progress tracking
- Install: Triggers Android system installer via MethodChannel
lib/cores/
├── constants/
│ └── github_references.dart # Repository configuration
├── services/
│ ├── github_update_service.dart # GitHub API integration
│ └── update_service.dart # Update orchestration
└── components/
└── update_dialog.dart # Update UI
android/.../MainActivity.kt # Native APK installation
⚡ QUICK_REFERENCE.md
Fast access guide with common tasks, markdown examples, and troubleshooting
📚 AUTO_UPDATE_FEATURE.md
Complete feature guide with configuration, testing, and troubleshooting
📋 IMPLEMENTATION_SUMMARY.md
Quick reference with code examples and architecture diagrams
🔄 IMPLEMENTATION_CHANGES.md
Detailed changelog from default Flutter app to auto-update implementation
👤 USER_EXPERIENCE_FLOW.md
User scenarios and experience flows
- Flutter SDK ^3.10.4
- Android device/emulator (API 21+)
- GitHub repository with releases
dio: ^5.3.3 # HTTP client
package_info_plus: ^4.2.0 # Version detection
path_provider: ^2.1.1 # File paths
flutter_markdown: ^0.7.4+1 # Markdown rendering for release notes| Platform | Status |
|---|---|
| ✅ Android | Full support |
| ❌ iOS | Not supported |
| ❌ Web | Not supported |
| ❌ Desktop | Not supported |
pubspec.yaml:
version: 1.0.0+1 # Update this before each releaseGitHub Release:
Tag: v1.0.0
Title: Initial Release
Description: (Optional markdown-formatted release notes)
Assets:
- app-prod-v1.0.0.apk
Tip
Write your GitHub release description in Markdown format! The update dialog will render it with proper formatting including headers, lists, bold text, code blocks, and more.
The update dialog supports full markdown rendering for GitHub release notes, making your updates more professional and informative.
- Headers:
# H1,## H2,### H3 - Bold:
**bold text** - Italic:
*italic text* - Lists:
- bulletor1. numbered - Code:
`inline code` - Code blocks:
```language ... ``` - Links:
[text](url) - Emojis: ✨ 🎉 🐛 ⚡ 📝
When creating a GitHub release, write markdown in the description field:
## 🎉 What's New in v1.0.0
### ✨ New Features
- **Dark mode support** - Toggle between light and dark themes
- Private repository authentication
- Markdown-formatted release notes
### 🐛 Bug Fixes
- Fixed download progress indicator
- Resolved installation issues on Android 12+
### ⚡ Performance
- Reduced APK size by 20%
- Faster update checks
For more details, see the [full changelog](https://github.com/yourrepo/releases).This will render beautifully in the update dialog with proper formatting, headers, and styling!
To use auto-updates with a private GitHub repository, you'll need to configure a Personal Access Token:
- Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click Generate new token (classic)
- Give it a name (e.g., "Auto Update Access")
- Select scopes: ✅ repo (Full control of private repositories)
- Click Generate token and copy it immediately
Edit lib/cores/constants/github_references.dart:
class GitHubReferences {
static const String owner = 'your_username';
static const String repo = 'your_private_repo';
static const String apkKey = 'prod';
static const String token = 'ghp_your_token_here'; // Your GitHub token
}Warning
Security Best Practice: Do not commit tokens to version control. Consider using environment variables or secure storage for production apps.
The token requires:
- ✅
reposcope for private repository access - ✅ Read access to releases
Tip
For public repositories, simply leave token as an empty string ('').
# Build release APK
flutter build apk --release
# Install on device
adb install build/app/outputs/flutter-apk/app-release.apk
# Launch app and check for updates- Public repos: Verify GitHub repository exists and is public
- Private repos: Ensure token is valid and has
reposcope - Check release is marked as "latest"
- Ensure APK is uploaded to release
- Confirm app version is lower than GitHub release version
- Check Platform.isAndroid is true
- Verify network connectivity
- Check FileProvider is configured in AndroidManifest.xml
- Ensure REQUEST_INSTALL_PACKAGES permission is added
- Verify provider_paths.xml exists
- ✅ HTTPS downloads from GitHub CDN
- ✅ FileProvider for secure file sharing
- ✅ User confirmation required
- ✅ Android system installer validation
- ✅ Signature verification by Android OS
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is a demonstration app for educational purposes.
Built with ❤️ using Flutter