scheduleOneShotAlarm method
Future<String>
scheduleOneShotAlarm({
- required double timestamp,
- String? label,
- String? tintColor,
- String? soundPath,
- Map<
String, dynamic> ? uiConfig,
override
Implementation
@override
Future<String> scheduleOneShotAlarm({
required double timestamp,
String? label,
String? tintColor,
String? soundPath,
Map<String, dynamic>? uiConfig,
}) async {
try {
final args = {
'timestamp': timestamp,
if (label != null) 'label': label,
if (tintColor != null) 'tintColor': tintColor,
if (soundPath != null) 'soundPath': soundPath,
if (uiConfig != null) 'uiConfig': uiConfig,
};
final alarmId = await methodChannel.invokeMethod<String>(
'scheduleOneShotAlarm',
args,
);
if (alarmId != null) {
debugPrint(
'[FlutterAlarmkit] One shot alarm $alarmId was scheduled successfully',
);
} else {
throw PlatformException(
code: 'UNKNOWN_ERROR',
message: 'Failed to schedule alarm: null result',
);
}
return alarmId;
} on PlatformException catch (e) {
_rethrowMapped(e);
}
}