Last updated:
0 purchases
schedule controller
schedule_controller #
Perform several different tasks daily. Straightforward and useful timer. It is easy to use. Execute tasks at fixed times. Confirm scheduled tasks before starting each time, if there are tasks, timing task generation.
Usage #
Let's explain to everyone
callback is a function that is executed every time
timeOutRunOnce is mean run once after timeout
timing means to call the callback function at every timing time. But you need to replace the [8:30AM] to [8.5]. There is no problem with the time zone, it will be automatically adjusted to the user's time.
readFn is a function to read data, you must return a value
writeFn is a function to write data
Future get(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.get(key);
}
Future save(String key, String value) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setString(key, value);
}
controller = ScheduleController([
Schedule(
timeOutRunOnce: true,
timing: [8, 10.5, 16, 18],
readFn: () async => await get('schedule'),
writeFn: (String data) async {
debugPrint(data);
await save('schedule', data);
},
callback: () {
debugPrint('schedule');
},
),
]);
controller.run();
copied to clipboard
Languages #
English 日本語 简体中文
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.