createTimer static method

void createTimer({
  1. required int length,
  2. String title = '',
  3. bool skipUi = true,
})

Creates a timer with a specified length in seconds.

Optionally timer's title can also be specified and whether clock app should open or not using the skipUi flag.

Implementation

static void createTimer({
  required int length,
  String title = '',
  bool skipUi = true,
}) {
  try {
    if (Platform.isAndroid) {
      _channel.invokeMethod('createTimer', <String, dynamic>{
        'length': length,
        'title': title,
        'skipUi': skipUi,
      });
    } else {
      throw UnimplementedError();
    }
  } on PlatformException {
    debugPrint('Error creating a timer.');
  }
}