You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To use this plugin, add `flutter_foreground_task` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example:
31
27
32
28
```yaml
33
29
dependencies:
34
-
flutter_foreground_task: ^8.14.0
30
+
flutter_foreground_task: ^8.16.0
35
31
```
36
32
37
33
After adding the plugin to your flutter project, we need to declare the platform-specific permissions ans service to use for this plugin to work properly.
@@ -204,10 +200,7 @@ class MyTaskHandler extends TaskHandler {
204
200
print('onStart(starter: ${starter.name})');
205
201
}
206
202
207
-
// Called by eventAction in [ForegroundTaskOptions].
208
-
// - nothing() : Not use onRepeatEvent callback.
209
-
// - once() : Call onRepeatEvent only once.
210
-
// - repeat(interval) : Call onRepeatEvent at milliseconds interval.
203
+
// Called based on the eventAction set in ForegroundTaskOptions.
211
204
@override
212
205
void onRepeatEvent(DateTime timestamp) {
213
206
// Send data to main isolate.
@@ -223,7 +216,7 @@ class MyTaskHandler extends TaskHandler {
223
216
print('onDestroy');
224
217
}
225
218
226
-
// Called when data is sent using [FlutterForegroundTask.sendDataToTask].
219
+
// Called when data is sent using `FlutterForegroundTask.sendDataToTask`.
227
220
@override
228
221
void onReceiveData(Object data) {
229
222
print('onReceiveData: $data');
@@ -330,9 +323,9 @@ void initState() {
330
323
// Add a callback to receive data sent from the TaskHandler.
0 commit comments