@@ -4,14 +4,18 @@ import 'package:background_location_tracker/src/model/config/background_location
44import 'package:flutter/services.dart' ;
55
66class ForegroundChannel {
7- static const _FOREGROUND_CHANNEL_NAME = 'com.icapps.background_location_tracker/foreground_channel' ;
7+ static const _FOREGROUND_CHANNEL_NAME =
8+ 'com.icapps.background_location_tracker/foreground_channel' ;
89
9- static const MethodChannel _foregroundChannel = MethodChannel (_FOREGROUND_CHANNEL_NAME );
10+ static const MethodChannel _foregroundChannel =
11+ MethodChannel (_FOREGROUND_CHANNEL_NAME );
1012
11- static Future <void > initialize (Function callbackDispatcher, {required BackgroundLocationTrackerConfig config}) async {
13+ static Future <void > initialize (Function callbackDispatcher,
14+ {required BackgroundLocationTrackerConfig config}) async {
1215 final callback = PluginUtilities .getCallbackHandle (callbackDispatcher);
1316 if (callback == null ) {
14- throw ArgumentError ('The callbackDispatcher needs to be either a static function or a top level function to be accessible as a Flutter entry point.' );
17+ throw ArgumentError (
18+ 'The callbackDispatcher needs to be either a static function or a top level function to be accessible as a Flutter entry point.' );
1519 }
1620 final handle = callback.toRawHandle ();
1721 await _foregroundChannel.invokeMethod <void >(
@@ -20,11 +24,16 @@ class ForegroundChannel {
2024 'callback_handle' : handle,
2125 'logging_enabled' : config.loggingEnabled,
2226 'android_config_channel_name' : config.androidConfig.channelName,
23- 'android_config_notification_body' : config.androidConfig.notificationBody,
24- 'android_config_notification_icon' : config.androidConfig.notificationIcon,
25- 'android_config_enable_notification_location_updates' : config.androidConfig.enableNotificationLocationUpdates,
26- 'android_config_cancel_tracking_action_text' : config.androidConfig.cancelTrackingActionText,
27- 'android_config_enable_cancel_tracking_action' : config.androidConfig.enableCancelTrackingAction,
27+ 'android_config_notification_body' :
28+ config.androidConfig.notificationBody,
29+ 'android_config_notification_icon' :
30+ config.androidConfig.notificationIcon,
31+ 'android_config_enable_notification_location_updates' :
32+ config.androidConfig.enableNotificationLocationUpdates,
33+ 'android_config_cancel_tracking_action_text' :
34+ config.androidConfig.cancelTrackingActionText,
35+ 'android_config_enable_cancel_tracking_action' :
36+ config.androidConfig.enableCancelTrackingAction,
2837 },
2938 );
3039 }
@@ -40,12 +49,16 @@ class ForegroundChannel {
4049 {
4150 'android_config_notification_body' : config? .notificationBody,
4251 'android_config_notification_icon' : config? .notificationIcon,
43- 'android_config_enable_notification_location_updates' : config? .enableNotificationLocationUpdates,
44- 'android_config_cancel_tracking_action_text' : config? .cancelTrackingActionText,
45- 'android_config_enable_cancel_tracking_action' : config? .enableCancelTrackingAction,
52+ 'android_config_enable_notification_location_updates' :
53+ config? .enableNotificationLocationUpdates,
54+ 'android_config_cancel_tracking_action_text' :
55+ config? .cancelTrackingActionText,
56+ 'android_config_enable_cancel_tracking_action' :
57+ config? .enableCancelTrackingAction,
4658 },
4759 );
4860 }
4961
50- static Future <void > stopTracking () => _foregroundChannel.invokeMethod ('stopTracking' );
62+ static Future <void > stopTracking () =>
63+ _foregroundChannel.invokeMethod ('stopTracking' );
5164}
0 commit comments