createAlarm static method

void createAlarm({
  1. required int hour,
  2. required int minutes,
  3. String title = '',
  4. bool skipUi = true,
})

Creates an alarm at the specified hour and minutes.

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

Implementation

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