platform_local_notifications 0.0.2 platform_local_notifications: ^0.0.2 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",
);