Home > Software engineering >  how to show notificatiion in badges like any other app
how to show notificatiion in badges like any other app

Time:07-22

I am using Flutter and FCM and Firestore for my project i need to show unread notification count above bell icon and if any user click on any notification then details of the notification please help with any article video or the code Thanks

CodePudding user response:

Check this answer on a similar issue "How to show a notification badge on the app icon using flutter?"

https://stackoverflow.com/a/65701373/1275796

CodePudding user response:

Please refer to this link description

Refer here for example

badges: ^2.0.3

If you are using awesome notifications don't forget to add channelShowBadge: true on NotificationChannel(), so that the counter will be shown on the app icon.

void main() async {
   WidgetsFlutterBinding.ensureInitialized();

   AwesomeNotifications().initialize(
     'resource://drawable/notification_icon', 
     [            // notification icon 
        NotificationChannel(
            channelGroupKey: 'basic_test',
            channelKey: 'basic',
            channelName: 'Basic notifications',
            channelDescription: 'Notification channel for basic tests',
            channelShowBadge: true, //make it true, to show notifications counter
        ),

     ]
  );
   
  runApp(MyApp()); //run your app.
}

  • Related