fl_updater 0.1.0
fl_updater: ^0.1.0 copied to clipboard
Firebase Remote Config-driven app update dialog with automatic wrapper, snoozable soft updates, and native App/Play Store opening.
Changelog #
0.1.0 #
Breaking Changes #
- Replaced the two flat Remote Config parameters with a single JSON-structured one.
fl_updater_latest_versionandfl_updater_min_versionare gone;fl_updaternow reads one String parameter,fl_updater_config, whose value is a JSON object:{"latest_version": "1.0.0", "min_version": "1.0.0"}.UpdateInfo.fromRemoteConfigValuesis replaced byUpdateInfo.fromRemoteConfigJson, which parses this JSON directly instead of taking aMap<String, String>.UpdateInfo.fromTemplateJsondrops its oldplatformparameter (aTargetPlatformused for Remote Config condition-based lookup of the old parameter names) in favor of aString? platformmatching the new JSON schema'splatformskey, and now reads thefl_updater_configparameter's default value using that schema.
- Renamed
enableInDebugModetoenabledonFlUpdaterWrapper,FlUpdater.checkForUpdate,FlUpdater.showUpdateDialog, andRemoteConfigService.checkForUpdate.enabledis now the single global gate for all automatic update behavior — the initial check, real-time listening, andclearSnoozeInDebugMode— checked first and taking precedence over every other flag.- Defaults to
!kDebugMode, matching the previous default behavior (checks skipped in debug, run in release). Unlike the old flag,enabledcan now also fully disable checking in release builds, not just opt into it in debug. - Toggling
enabledat runtime (e.g. via a rebuild) now dynamically tears down or re-establishes the real-time Remote Config listener.
- Raised the minimum supported SDK to Dart
>=3.4.0and Flutter>=3.24.0(previously>=3.0.0/>=3.10.0), required by the newfp_loggerdependency (see Improvements). - Removed the exported
FlUpdaterLoggerclass. Diagnostic logging is now emitted directly viafp_logger'sLogger;FlUpdater.enableLoggingand everyenableLoggingparameter are unaffected.
Features #
- Per-Flavor and Per-Platform Remote Config Targeting: Support for multiple apps registered under the same Firebase project (one per build flavor), and/or different version numbers per platform, from a single
fl_updater_configparameter. Nest optionalflavors(keyed by flavor name, e.g.development,staging,uat,production) and/orplatforms(keyed byandroid/ios, each of which can itself nest its ownflavors) objects in the JSON.RemoteConfigService.checkForUpdate/evaluateActiveConfig,FlUpdater.checkForUpdate/showUpdateDialog, andFlUpdaterWrappernow acceptflavorandplatformparameters (defaulting to Flutter's built-inappFlavorand the detected platform respectively, so most apps need no code change). Every object and field is optional —latest_versionandmin_versionare each resolved independently, most specific first:platforms.<platform>.flavors.<flavor>, thenplatforms.<platform>, thenflavors.<flavor>, then the top-level field.
Fixes #
VersionComparatornow correctly parses versions with a build-number suffix inx.x.x+xform (e.g.1.0.0+10, matchingpubspec.yaml'sversion:field convention). Previously the+buildsuffix corrupted the patch segment's parse (silently falling back to0); it's now parsed as its own trailing precedence tier, compared only once every semantic segment (major/minor/patch) is equal.- Fixed
RemoteConfigServicereading the installed version fromPackageInfo.versionalone, which never includes the build number. Anymin_version/latest_versionconfigured with a+BUILDsuffix therefore always compared as newer than the installed build, showing the non-dismissible force-update dialog on every launch even when the installed build already satisfiedmin_version. The installed build number is now appended (x.x.x+x) before comparison. - Fixed a crash —
The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget— that could occur whenFlUpdaterWrapperpresented its update dialog in apps where the wrapper wasn't a strict ancestor of the app'sNavigator. The Navigator lookup now also searches from the app's root element and always resolves to a genuine Navigator-descendant context. - Fixed the Android module requiring a very recent Gradle/AGP/Kotlin toolchain (
Minimum supported Gradle version is 9.3.1), which broke builds on older but still current Gradle installs. Lowered the pinned Android Gradle Plugin and Kotlin versions and made Kotlin plugin application AGP-version-aware, so the module now builds correctly across both older and newer Android toolchains.
Improvements #
- Trimmed diagnostic logging (
enableLogging: true) to fewer, denser lines — removed redundant/duplicate log lines and consolidated multi-line status output (current version, fetched config, evaluated status) into a single line per check. - Replaced the hand-rolled
debugPrint/dev.loglogging withfp_logger, giving diagnostic logs (enableLogging: true) formatted, colorized console output. - The fetched
fl_updater_configJSON is now logged pretty-printed (indented, multi-line) on its own, instead of dumped inline as one unreadable minified blob in the status summary line.
0.0.2 #
Release of fl_updater, a lightweight, cost-conscious Flutter plugin for Firebase Remote Config-driven app updates.
Features #
- Automatic Update Wrapper (
FlUpdaterWrapper): Check and present update dialogs seamlessly upon app launch viaMaterialApp.builderwith automaticNavigatorresolution and customnavigatorKeysupport. - Programmatic API (
FlUpdater): Check for updates (checkForUpdate) and present update dialogs (showUpdateDialog) imperatively. - Remote Config Integration:
- Evaluates
fl_updater_latest_versionandfl_updater_min_versionparameters. - Supports platform-specific targeting using Firebase Remote Config conditions (
fl_updater_androidandfl_updater_ios). - Offline / template JSON parsing support via
UpdateInfo.fromTemplateJson.
- Evaluates
- Two-Tier Update System:
- Soft updates: Optional update prompt with a "Later" button.
- Force updates: Mandatory blocking dialog (
canPop: false) when the installed version is belowfl_updater_min_version.
- Smart Snoozing:
- Snooze soft updates for a customizable duration (default: 3 days), scoped per version.
clearSnoozeInDebugModeflag onFlUpdaterWrapperto automatically clear saved snooze state on launch in debug mode.- Programmatic snooze reset methods:
FlUpdater.clearSnoozeStore()andFlUpdater().clearSnooze().
- Real-Time Remote Config Updates:
- Real-time listeners (
FirebaseRemoteConfig.onConfigUpdated) automatically activate published changes tofl_updater_latest_versionandfl_updater_min_versioninstantly without waiting forminimumFetchInterval. - Enabled by default with
listenForRealtimeUpdates: trueonFlUpdaterWrapper.
- Real-time listeners (
- Cost-Conscious Fetching & Quota Optimization:
- Disabled in
kDebugModeby default to prevent burning Remote Config fetch quotas during development and hot reloads. - Configurable
minimumFetchInterval(default: 1 hour) caching.
- Disabled in
- Diagnostic Logging:
- Built-in
FlUpdaterLoggerutility with global and localenableLoggingtoggles.
- Built-in
- Native Store Integration:
- Native redirection to the Apple App Store (via numeric
iosAppId) and Google Play Store (viaandroidPackageId).
- Native redirection to the Apple App Store (via numeric
- Extensible UI & Styling:
- Customizable dialog appearance using
FlUpdaterDialogStyle. - Complete UI override using custom
dialogBuilder(FlUpdaterDialogBuilder).
- Customizable dialog appearance using
0.0.1 #
Initial release of fl_updater, a lightweight, cost-conscious Flutter plugin for Firebase Remote Config-driven app updates.