schedule_controller 0.1.0 copy "schedule_controller: ^0.1.0" to clipboard
schedule_controller: ^0.1.0 copied to clipboard

outdated

Perform several different tasks daily. Very simple and useful timer. It is easy to use.

schedule_controller #

Perform several different tasks daily. Very simple and useful timer. It is easy to use. Execute task at fixed time. Confirm scheduled tasks before starting each time, if there are tasks, timing task generation.

pub version license

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();

Languages #

English 日本語 简体中文

10
likes
0
pub points
22%
popularity

Publisher

unverified uploader

Perform several different tasks daily. Very simple and useful timer. It is easy to use.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on schedule_controller