scheduleNotification method

  1. @override
Future<bool> scheduleNotification({
  1. required int id,
  2. required String title,
  3. required String message,
  4. required int scheduledEpochMillis,
  5. String? channelId,
  6. NotificationImportance? importance,
  7. bool alarmSound = false,
  8. String? targetScreen,
  9. 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;
}