scheduleRecurrentAlarm method
Implementation
@override
Future<String> scheduleRecurrentAlarm({
required int weekdayMask,
required int hour,
required int minute,
String? label,
String? tintColor,
}) async {
try {
final args = <String, dynamic>{
'weekdayMask': weekdayMask,
'hour': hour,
'minute': minute,
if (label != null) 'label': label,
if (tintColor != null) 'tintColor': tintColor,
};
final alarmId = await methodChannel.invokeMethod<String>(
'scheduleRecurrentAlarm',
args,
);
if (alarmId == null) {
throw PlatformException(
code: 'UNKNOWN_ERROR',
message: 'Failed to schedule recurrent alarm: null result',
);
}
return alarmId;
} on PlatformException catch (e) {
if (e.code == 'UNSUPPORTED_VERSION') {
throw PlatformException(
code: 'UNSUPPORTED_VERSION',
message: 'AlarmKit is only available on iOS 26.0 and above',
);
}
rethrow;
}
}