Created
April 17, 2019 10:36
-
-
Save jesusrp98/c6a9376adf74c573aeb4fd98b211a46d to your computer and use it in GitHub Desktop.
Scoped model which inits the notification system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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