autoupdater_standalone library
Standalone adapter for the autoupdater plugin.
This export includes AutoUpdaterStandalone which uses Flutter's built-in ValueNotifier for reactive state management. No external dependencies required.
Usage
import 'package:releasehub_updater/autoupdater_standalone.dart';
// Create the service with optional UI handlers
final updater = AutoUpdaterStandalone(
config: AutoUpdaterConfig(
baseUrl: 'https://your-server.com',
appId: 'com.example.app',
environment: 'prod',
checkOnStartup: true,
),
ui: AutoUpdaterDefaultUI.create(
primaryColor: Colors.blue,
),
);
// Initialize (call once at app startup)
await updater.initialize();
// Manual check with context for dialogs
await updater.checkForUpdate(silent: false, context: context);
Using with ValueListenableBuilder
ValueListenableBuilder<bool>(
valueListenable: updater.isCheckingForUpdate,
builder: (context, isChecking, child) {
return isChecking
? CircularProgressIndicator()
: ElevatedButton(
onPressed: () => updater.checkForUpdate(
silent: false,
context: context,
),
child: Text('Check for Updates'),
);
},
)
Custom UI Handlers
final updater = AutoUpdaterStandalone(
config: myConfig,
ui: AutoUpdaterStandaloneUI(
onShowUpdateAvailable: (context, info, onDownload) {
// Show your custom dialog
showMyCustomDialog(context!, info, onDownload);
},
onShowError: (context, title, message) {
// Show your custom error UI
MyToast.showError('$title: $message');
},
onShowDownloadProgress: (context, progress, status, isDownloading) {
// Show custom progress UI
showMyProgressOverlay(progress, status);
// Return a callback to dismiss it
return () => hideMyProgressOverlay();
},
),
);
Integration with Provider/Riverpod
Since AutoUpdaterStandalone uses ValueNotifier, it integrates seamlessly with Provider or Riverpod:
// Provider
Provider<AutoUpdaterStandalone>(
create: (_) => AutoUpdaterStandalone(config: myConfig)..initialize(),
dispose: (_, updater) => updater.dispose(),
)
// Riverpod
final autoUpdaterProvider = Provider((ref) {
final updater = AutoUpdaterStandalone(config: myConfig);
updater.initialize();
ref.onDispose(() => updater.dispose());
return updater;
});
Classes
- AutoUpdater
- Simple static API for the auto-updater.
- AutoUpdaterConfig
- Configuration for the auto-updater plugin.
- AutoUpdaterCore
- Core auto-updater service (framework-agnostic).
- AutoUpdaterDefaultUI
- Pre-built UI handlers using Flutter's built-in dialogs and snackbars.
- AutoUpdaterStandalone
- Standalone auto-updater service using Flutter's built-in ValueNotifier.
- AutoUpdaterStandaloneUI
- UI callbacks for the standalone auto-updater.
- AutoUpdaterStrings
- Customizable strings for the auto-updater UI.
- CurrentVersionInfo
- Current app version information
- DownloadCancelled
- DownloadError
- DownloadProgress
- Download progress information
- DownloadProgressStyle
- Style configuration for DownloadProgressWidget
- DownloadProgressWidget
- A customizable download progress widget.
- DownloadResult
- Download result
- DownloadSuccess
- InstallError
- InstallManualRequired
- InstallPermissionDenied
- InstallResult
- Installation result
- InstallSuccess
- NoUpdateAvailable
- UpdateAvailable
- UpdateAvailableBanner
- A simple update available banner widget.
- UpdateBannerStyle
- Style configuration for UpdateAvailableBanner
- UpdateCheckDisabled
- UpdateCheckError
- UpdateCheckResult
- Update check result
- VersionCheckButton
- A version check button widget with loading state.
- VersionCheckButtonStyle
- Style configuration for VersionCheckButton
- VersionInfo
- Parsed version information from the server
- VersionResponseFields
- Configuration for parsing the version check JSON response. Allows customization of field names for different backend implementations.