scheduleRecurrentAlarm method
Future<String>
scheduleRecurrentAlarm({
- required int weekdayMask,
- required int hour,
- required int minute,
- String? label,
- String? tintColor,
- String? soundPath,
override
Implementation
@override
Future<String> scheduleRecurrentAlarm({
required int weekdayMask,
required int hour,
required int minute,
String? label,
String? tintColor,
String? soundPath,
}) async {
try {
final args = <String, dynamic>{
'weekdayMask': weekdayMask,
'hour': hour,
'minute': minute,
if (label != null) 'label': label,
if (tintColor != null) 'tintColor': tintColor,
if (soundPath != null) 'soundPath': soundPath,
};
final alarmId = await methodChannel.invokeMethod<String>(
'scheduleRecurrentAlarm',
args,
);
if (alarmId != null) {
debugPrint(
'[FlutterAlarmkit] Recurrent alarm $alarmId was scheduled successfully',
);
} else {
throw PlatformException(
code: 'UNKNOWN_ERROR',
message: 'Failed to schedule 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;
}
}