localNotifications static method
dynamic
localNotifications(
- dynamic callback(
- FlutterLocalNotificationsPlugin localNotifications
Get the local notifications plugin
Implementation
static localNotifications(
Function(FlutterLocalNotificationsPlugin localNotifications)
callback) async {
Nylo nylo = Nylo.instance;
FlutterLocalNotificationsPlugin? flutterLocalNotifications =
nylo.getLocalNotifications();
if (flutterLocalNotifications == null) {
flutterLocalNotifications = FlutterLocalNotificationsPlugin();
nylo.setLocalNotifications(flutterLocalNotifications);
}
if (nylo.isFlutterLocalNotificationsInitialized) {
await callback(flutterLocalNotifications);
return;
}
nylo.isFlutterLocalNotificationsInitialized =
await flutterLocalNotifications.initialize(
nylo.getInitializationSettings() ?? InitializationSettings(),
onDidReceiveBackgroundNotificationResponse:
notificationTapBackground,
onDidReceiveNotificationResponse:
onDidReceiveNotificationResponse,
) ??
false;
await callback(flutterLocalNotifications);
}