Push notification in flutter
In a minute

Before we start, make sure that your app is linked with firebase.
Then use this library in your pubspec.yaml file
firebase_messaging: ^1.0.3
We are good to go now, Let’s import the Firebase_messaging class and create an instance of it.
import ‘package:firebase_messaging/firebase_messaging.dart’;
FirebaseMessaging messaging = FirebaseMessaging();
Now, use it in our initState() method.
For Android

so, what is this?
we are configuring the firebase messaging, and we are also using it’s three properties to setup our messageHandler.
OnLaunch: when our app is close, and notification arrives, when you click on that notification OnLaunch get called and it just open the app from scratch(simple enough).
OnResume: when our app is running in the background, and notification arrives, when you click on that notification OnResume get called, it just resumes your app.
OnMessage: when our app is running and in the foreground, then OnMessage gets triggered.
For IOS

Here, first of all we are requsting to show notification, and whatever they say yes/no, we will listen it, and act upon it.
That’s it, now you can go in your firebase console and send notifications to your users.
If you like it ❤️
Tap the clap 👏 button it motivates me to write.
Let me know, if I got something wrong 🐛
Happy coding;

