@@ -81,22 +81,25 @@ class _MyAppState extends State<MyApp> {
81
81
onPressed: _requestLocationPermission,
82
82
),
83
83
if (Platform .isAndroid) ...[
84
- const Text ('Permission on android is only needed starting from sdk 33.' ),
84
+ const Text (
85
+ 'Permission on android is only needed starting from sdk 33.' ),
85
86
],
86
87
MaterialButton (
87
88
child: const Text ('Request Notification permission' ),
88
89
onPressed: _requestNotificationPermission,
89
90
),
90
91
MaterialButton (
91
92
child: const Text ('Send notification' ),
92
- onPressed: () => sendNotification ('Hello from another world' ),
93
+ onPressed: () =>
94
+ sendNotification ('Hello from another world' ),
93
95
),
94
96
MaterialButton (
95
97
child: const Text ('Start Tracking' ),
96
98
onPressed: isTracking
97
99
? null
98
100
: () async {
99
- await BackgroundLocationTrackerManager .startTracking ();
101
+ await BackgroundLocationTrackerManager
102
+ .startTracking ();
100
103
setState (() => isTracking = true );
101
104
},
102
105
),
@@ -106,7 +109,8 @@ class _MyAppState extends State<MyApp> {
106
109
? () async {
107
110
await LocationDao ().clear ();
108
111
await _getLocations ();
109
- await BackgroundLocationTrackerManager .stopTracking ();
112
+ await BackgroundLocationTrackerManager
113
+ .stopTracking ();
110
114
setState (() => isTracking = false );
111
115
}
112
116
: null ,
@@ -184,7 +188,8 @@ class _MyAppState extends State<MyApp> {
184
188
185
189
void _startLocationsUpdatesStream () {
186
190
_timer? .cancel ();
187
- _timer = Timer .periodic (const Duration (milliseconds: 250 ), (timer) => _getLocations ());
191
+ _timer = Timer .periodic (
192
+ const Duration (milliseconds: 250 ), (timer) => _getLocations ());
188
193
}
189
194
}
190
195
@@ -215,12 +220,15 @@ class LocationDao {
215
220
216
221
SharedPreferences ? _prefs;
217
222
218
- Future <SharedPreferences > get prefs async => _prefs ?? = await SharedPreferences .getInstance ();
223
+ Future <SharedPreferences > get prefs async =>
224
+ _prefs ?? = await SharedPreferences .getInstance ();
219
225
220
226
Future <void > saveLocation (BackgroundLocationUpdateData data) async {
221
227
final locations = await getLocations ();
222
- locations.add ('${DateTime .now ().toIso8601String ()} ${data .lat },${data .lon }' );
223
- await (await prefs).setString (_locationsKey, locations.join (_locationSeparator));
228
+ locations.add (
229
+ '${DateTime .now ().toIso8601String ()} ${data .lat },${data .lon }' );
230
+ await (await prefs)
231
+ .setString (_locationsKey, locations.join (_locationSeparator));
224
232
}
225
233
226
234
Future <List <String >> getLocations () async {
0 commit comments