scheduleNotification method
Future<bool>
scheduleNotification({
- required int id,
- required String title,
- required String message,
- required int scheduledEpochMillis,
- String? channelId,
- NotificationImportance? importance,
- bool alarmSound = false,
- String? targetScreen,
- Map<
String, dynamic> ? extraData,
override
Schedule a notification to be delivered by the operating system at a specific point in time, even when the app is fully closed.
Implementation
@override
Future<bool> scheduleNotification({
required int id,
required String title,
required String message,
required int scheduledEpochMillis,
String? channelId,
NotificationImportance? importance,
bool alarmSound = false,
String? targetScreen,
Map<String, dynamic>? extraData,
}) async {
final args = <String, dynamic>{
'id': id,
'title': title,
'message': message,
'scheduledEpochMillis': scheduledEpochMillis,
'channelId': channelId,
'alarmSound': alarmSound,
'targetScreen': targetScreen,
'extraData': extraData,
};
if (importance != null) args['priority'] = importance.value;
final result = await methodChannel.invokeMethod<bool>(
'scheduleNotification',
args,
);
return result ?? false;
}