A Flutter plugin which allows you to execute code in the background on Android and iOS.
851
stars
260
forks
source link
how to schedule task for every day at 12 AM ? final tomorrowMidnight = DateTime( now.year, now.month, now.day + 1, 0, 0); // Midnight of the next day final initialDelay = tomorrowMidnight.isBefore(now) ? tomorrowMidnight.add(const Duration(days: 1)).difference( now) // If it's already past midnight, schedule for the next day : tomorrowMidnight.difference(now); Workmanager().initialize(callbackDispatcher); Workmanager().registerPeriodicTask( "birthdayCheckTask3", // Unique task ID "birthdayCheckTask", // Task name initialDelay: initialDelay, frequency: const Duration(days: 1) // Run daily ); that's not working #502
Version
Describe the error Describe error Optionally provide the least amount of code that shows this behaviour. Ideally in the
sample
app.Output of
flutter doctor -v