flutter_local_notifications_provider 0.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

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.1.0]

  • First release

[0.2.0]

  • Improved documentation

example/README.md

example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_local_notifications_provider: ^0.2.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_local_notifications_provider/flutter_local_notifications_provider.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Dec 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Health suggestions

Fix lib/src/provider.dart. (-0.50 points)

Analysis of lib/src/provider.dart reported 1 hint:

line 22 col 10: 'ancestorInheritedElementForWidgetOfExactType' is deprecated and shouldn't be used. Use getElementForInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flutter_local_notifications).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_local_notifications ^0.6.0 0.6.1 0.8.4+3
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
platform 2.2.1
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test