5.0.0 beta #1595
christocracy
announced in
Announcements
5.0.0 beta
#1595
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🚀 Migration Guide: Flat Config → Compound Config
📢 Overview
Version 5 introduces a new Compound Config format that replaces the legacy "flat" config structure. This guide explains the migration steps, provides before/after examples, and details key differences.
Installation
See the README in
5.0.0-betabranch.Opt in to the beta by adding this to your
pubspec.yaml:(ℹ️ See pub.dev for latest
v5.0.0.betaversion (new beta versions are published quite often).⚙️ Compatibility
The legacy flat config style remains fully supported for backward compatibility.
You can continue using your existing flat configuration if you prefer, though new features may only appear in the compound structure.
⏩ Why Compound Config?
🏗️ Old vs. New Config Structure
Before (Flat Config)
After (Compound Config)
🗺️ Mapping Table: Flat → Compound
desiredAccuracygeolocationdesiredAccuracygeolocation: GeoConfig(desiredAccuracy: ...)distanceFiltergeolocationdistanceFilterstopOnTerminateappstopOnTerminateapp: AppConfig(stopOnTerminate: ...)startOnBootappstartOnBooturlhttpurlhttp: HttpConfig(url: ...)headershttpheaderslogLevelloggerlogLevellogger: LoggerConfig(logLevel: ...)debugloggerdebug🧑💻 Migration Steps
Update your dependency:
Ensure you are using
flutter_background_geolocationv5.0.0 or later.Import new config classes:
Group related options:
GeoConfigHttpConfigLoggerConfigAppConfigActivityConfigPersistenceConfigReplace flat keys:
Config(...)directly, pass the relevant compound config objects.Check for breaking changes:
📝 Example Migration
Flat Config (Old)
Compound Config (New)
🧩 Compound Config Groups
geolocationGeoConfigappAppConfighttpHttpConfigloggerLoggerConfigactivityActivityConfigpersistencePersistenceConfigEach group is a separate Dart class. See API docs for details.
🛠️ Full Mapping Table
desiredAccuracygeolocationdesiredAccuracydistanceFiltergeolocationdistanceFilterstationaryRadiusgeolocationstationaryRadiusstopTimeoutgeolocationstopTimeoutstopAfterElapsedMinutesgeolocationstopAfterElapsedMinutesgeofenceProximityRadiusgeolocationgeofenceProximityRadiusgeofenceInitialTriggerEntrygeolocationgeofenceInitialTriggerEntrygeofenceModeHighAccuracygeolocationgeofenceModeHighAccuracypausesLocationUpdatesAutomaticallygeolocationpausesLocationUpdatesAutomaticallyshowsBackgroundLocationIndicatorgeolocationshowsBackgroundLocationIndicatoractivityTypegeolocationactivityTypelocationAuthorizationAlertgeolocationlocationAuthorizationAlertmaxMonitoredGeofencesgeolocationmaxMonitoredGeofencesfiltergeolocationfilterstopOnTerminateappstopOnTerminatestartOnBootappstartOnBootenableHeadlessappenableHeadlessheartbeatIntervalappheartbeatIntervalscheduleappschedulescheduleUseAlarmManagerappscheduleUseAlarmManagernotificationappnotificationbackgroundPermissionRationaleappbackgroundPermissionRationalepreventSuspendapppreventSuspendurlhttpurlautoSynchttpautoSyncautoSyncThresholdhttpautoSyncThresholddisableAutoSyncOnCellularhttpdisableAutoSyncOnCellularbatchSynchttpbatchSyncmaxBatchSizehttpmaxBatchSizemethodhttpmethodparamshttpparamsheadershttpheadersrootProperty/httpRootPropertyhttprootPropertytimeout/httpTimeouthttptimeoutdebugloggerdebuglogLevelloggerlogLevelLogLevellogMaxDaysloggerlogMaxDaysactivityRecognitionIntervalactivityactivityRecognitionIntervalminimumActivityRecognitionConfidenceactivityminimumActivityRecognitionConfidencedisableStopDetectionactivitydisableStopDetectionstopOnStationaryactivitystopOnStationarymotionTriggerDelayactivitymotionTriggerDelaytriggerActivitiesactivitytriggerActivitiesdisableMotionActivityUpdatesactivitydisableMotionActivityUpdatesstopDetectionDelayactivitystopDetectionDelaypersistModepersistencepersistModemaxDaysToPersistpersistencemaxDaysToPersistmaxRecordsToPersistpersistencemaxRecordsToPersistlocationsOrderDirectionpersistencelocationsOrderDirectionlogLevelis now aLogLevelenum (e.g.,LogLevel.info), but legacy integer values are still supported for backward compatibility. You may use either the new enum or the legacy integer type.debugis now inLoggerConfig.v5.0.0introduces a new format for license keys. You can generate them in the Customer Dashboard. Both iOS and Android now require a license key:🧪 Testing Your Migration
🆘 Need Help?
📚 Resources
🎉 Happy Migrating!
If you have suggestions for improving this guide, please open a PR or issue.
Beta Was this translation helpful? Give feedback.
All reactions