platform_local_notifications 1.0.0 copy "platform_local_notifications: ^1.0.0" to clipboard
platform_local_notifications: ^1.0.0 copied to clipboard

platform local notifications support all platform for local notify https://pub.dev/packages/platform_local_notifications

  • push local notifications any where in flutter

  • for web add OverlaySupport


  OverlaySupport.global(
      child: MaterialApp(
        title: 'Flutter Demo',
        debugShowCheckedModeBanner: false,
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        darkTheme: ThemeData.dark(),
        home: const Home( ),
      ),
    );

first init #

 await PlatformNotifier.I.init(appName: "test app name");

Request notification permissions #

 bool? isAccepted = await PlatformNotifier.I.requestPermissions();
 print("isAccepted $isAccepted");

to show normal notification #

  await PlatformNotifier.I.showPluginNotification(
      ShowPluginNotificationModel(
          id: DateTime.now().second,
          title: "title",
          body: "body",
          payload: "test"),

to show chat notifications with action (Reply and mark as read) buttons #

 await PlatformNotifier.I.showChatNotification(
                model: ShowPluginNotificationModel(
                  id: DateTime.now().second,
                  title: "title",
                  body: "body",
                  payload: "test",
                ),
                userImage: "https://thumbs.dreamstime.com/b/default-avatar-profile-vector-user-profile-default-avatar-profile-vector-user-profile-profile-179376714.jpg",
                conversationTitle: "conversationTitle",
                userName: "userName",
              );

Listen for chick and actions stream #

  void _setUpStreams() {
    PlatformNotifier.I.platformNotifierStream.listen(
      (event) {
        if (event is PluginNotificationClickAction) {
          //handle when user click on the notification
        }
        if (event is PluginNotificationReplyAction) {
          //handle when user choose reply action
        }
        if (event is PluginNotificationMarkRead) {
          //handle when user submit value to reply textile
        }
      },
    );
  }

9
likes
130
pub points
75%
popularity

Publisher

unverified uploader

platform local notifications support all platform for local notify https://pub.dev/packages/platform_local_notifications

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_cache_manager, flutter_local_notifications, local_notifier, quick_notify_2

More

Packages that depend on platform_local_notifications