local_notifications 0.0.1 copy "local_notifications: ^0.0.1" to clipboard
local_notifications: ^0.0.1 copied to clipboard

discontinued
outdatedDart 1 only

A flutter plugin for creating local notifications.

local_notifications #

A Flutter plugin for showing and removing notifications.

Usage #

See the full example here

Features supported by platform #

Feature Android ios
Create local notification with custom title and content
  • - [x]
  • - [x]
Create local notification with custom actions with custom callbacks
  • - [x]
  • - [x]
Dismiss local notification which is already delivered
  • - [x]
  • - [x]
Create local notification with an image
  • - [x]
  • - [ ]
Create local notification which is undismissable
  • - [x]
  • - [ ]

Android set up steps #

To have the notification run code in the background (on click of either the notification itself or its actions), you must add the LocalNotificationsService to your app's manifest. Add the following to the

<service
  android:name="com.mythichelm.localnotifications.LocalNotificationsService"
  android:exported="false" />

Examples #

Creating a basic notification with title and text content #

int id = await LocalNotifications.createNotification(
                  'Basic', 'some basic notification',
              );

Creating a notification with an image #

int id = await LocalNotifications.createNotification(
                  'Image', 'some notification with an image',
                  imageUrl: 'https://flutter.io/images/catalog-widget-placeholder.png',
              );

Creating an undismissable notification #

int id = await LocalNotifications.createNotification(
                  'Title', 'content',
                  imageUrl: 'https://flutter.io/images/catalog-widget-placeholder.png',
                  isOngoing: true
              );

Removing a notification #

await LocalNotifications.removeNotification(id);

Creating a notification that will run code in background on click #

onNotificationClick(String payload) {
	// payload is 'some payload'
	print('Running in background and received payload: $payload');
}


int id = await LocalNotifications.createNotification(
            'Some title',
            'Some content',
            onNotificationClick: new NotificationAction(
                "this_is_ignored", // title of action is ignored for notification click
                onNotificationClick, // your callback
                "some payload",
              launchesApp: false
            ),
        );

Creating a notification with multiple actions, some run in background, some bring app to foreground #

For code, see the example.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

3
likes
0
pub points
59%
popularity

Publisher

unverified uploader

A flutter plugin for creating local notifications.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on local_notifications