flutter_local_notifications_provider 0.2.1
flutter_local_notifications_provider: ^0.2.1 copied to clipboard

Flutter Android iOS

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
70
pub points
50%
popularity

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

Documentation

API reference

Uploader

alef.carlos@gmail.com

License

unknown (LICENSE)

Dependencies

flutter, flutter_local_notifications

More

Packages that depend on flutter_local_notifications_provider