import 'package:flutter_foreground_task/flutter_foreground_task.dart';

void startCallback() {
  FlutterForegroundTask.setTaskHandler(MyTaskHandler());
}

class MyTaskHandler extends TaskHandler {
  @override
  Future<void> onStart(DateTime timestamp, TaskStarter? starter) async {
    // Initialization code, e.g. open DB or services
  }

  @override
  Future<void> onDestroy(DateTime timestamp, bool isTimeout) async {
    // Clean up if needed
  }

  @override
  void onRepeatEvent(DateTime timestamp) {
    // Called based on the eventAction set in ForegroundTaskOptions
  }
}
