Skip to content

Instantly share code, notes, and snippets.

@jesusrp98
Created April 17, 2019 10:36
Show Gist options
  • Save jesusrp98/c6a9376adf74c573aeb4fd98b211a46d to your computer and use it in GitHub Desktop.
Save jesusrp98/c6a9376adf74c573aeb4fd98b211a46d to your computer and use it in GitHub Desktop.
Scoped model which inits the notification system
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
// ...
class AppModel extends Model {
static final FlutterLocalNotificationsPlugin _notifications =
FlutterLocalNotificationsPlugin();
// ...
FlutterLocalNotificationsPlugin get notifications => _notifications;
Future init() async {
notifications.initialize(InitializationSettings(
AndroidInitializationSettings('notification_launch'),
IOSInitializationSettings(),
));
// ...
notifyListeners();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment