flutter_local_notifications_provider 0.2.1 copy "flutter_local_notifications_provider: ^0.2.1" to clipboard
flutter_local_notifications_provider: ^0.2.1 copied to clipboard

It adds FlutterLocalNotificationsPlugin into Widget Tree using InheritedWidget. It is nice when you need to get its reference in other pages.

Flutter Local Notifications Provider #

pub package

It adds a functionality in the main package .

Features #

  • Adding FlutterLocalNotificationsPlugin into Widget Tree via InheritedWidget

Example #

After you are done with basic setup, you just need to add this into Widget Tree

@override
Widget build(BuildContext context) {
    return NotificationProvider(
        service: flutterLocalNotificationsPlugin,
        child: MaterialApp(
            title: 'Title',
            theme: new ThemeData(
                primarySwatch: Colors.blue,
            ),
            home: widget.home),
    );
}

NotificationProvider needs plugins's reference.

You can access it using NotificationProvider.of(context);, for example:

...
        child: RaisedButton(
          onPressed: () async {
            await _showNotification(context);
          },
          child: Text('Test with notification'),
        ),
....

  Future _showNotification(BuildContext context) async {
    var plugin = NotificationProvider.of(context);
    var androidPlatformChannelSpecifics = AndroidNotificationDetails(
        'your channel id', 'your channel name', 'your channel description',
        importance: Importance.Max, priority: Priority.High);
    var iOSPlatformChannelSpecifics = IOSNotificationDetails();
    var platformChannelSpecifics = NotificationDetails(
        androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
    await plugin.show(0, 'Title', 'Description',
        platformChannelSpecifics);
  }
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

It adds FlutterLocalNotificationsPlugin into Widget Tree using InheritedWidget. It is nice when you need to get its reference in other pages.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_local_notifications

More

Packages that depend on flutter_local_notifications_provider