| 123456789101112131415161718192021222324 |
- import 'package:flutter_foreground_task/flutter_foreground_task.dart';
- class RecordTaskHandler extends TaskHandler {
- @override
- void onDestroy(DateTime timestamp) {
- // TODO: implement onDestroy
- }
- @override
- void onRepeatEvent(DateTime timestamp) {
- // TODO: implement onRepeatEvent
- }
- @override
- void onStart(DateTime timestamp) {
- // TODO: implement onStart
- }
- }
- @pragma('vm:entry-point')
- void setRecordCallback() {
- // The setTaskHandler function must be called to handle the task in the background.
- FlutterForegroundTask.setTaskHandler(RecordTaskHandler());
- }
|