Testing flutter WorkManager

47 views Asked by At

Is there a way to test the Workmanager on a more frequent basis than 15minutes?

I am actually using the Workmanager and was wondering if there is a way to get it run more often than 15minutes. Because waiting 15minutes each time would take me hours to test my business logic.

@pragma('vm:entry-point')
void callbackDispatcher() {
  Workmanager().executeTask((task, inputData) {
    debugPrint("Native called background task: $task");
    return Future.value(true);
  });
}

void initializeWorkManager() {
  Workmanager().initialize(
      callbackDispatcher, // The top level function, aka callbackDispatcher
      isInDebugMode:
          true
      );
  Workmanager().registerPeriodicTask(
    myIdentifier,
    myTaskName,
    frequency: const Duration(minutes: 15),
  );
}
0

There are 0 answers