How To Send Notification using OneSignal with Flutter and Firebase.

Send the Notification From One Device to another Device using the OneSignal Rest API.

This is common knowledge that notifications are one of the most important communication channels between users and apps. By using this as a means of communication one can reach out to the user with some short messages and can interact with them. Push notifications are the best means to notify the updates to the existing users.

Advantages Of OneSignal

  1. Set up push notifications in OneSignal is simple and easy to follow.
  2. Supports unlimited devices and notifications without any charges.
  3. It provides a Single API and UI to send the notification across different platforms like Android, IOS, and Web.
  4. It is easy to connect to the Firebase Console.

Getting Started With the OneSignal

Step 1: App Registration with OneSignal.

  • Click on Add a new app. Select the android and Fill in the name of the app and click configure your platform.
Enter the name of Your app and Select the platform
  • open the project->project setting and select the Cloud Messaging. Then you find the server key and sender Id.
copy the server key and sender ID
paste the server key, sender Id, and Save.
  • Now in the OneSignal website navigate to the Settings->Keys & IDs to find your App Id and Rest API Key
find your app id and rest API key.
  • Navigate to android->app->build. gradle and add the following lines of code.
Add the above line in the build. gradle
add this block of code in the main. dart file
  • After building the flutter application check the dashBoard on the OneSignal website to view the subscribed users.
You can see the number of active and registered users of your application.
  • To get the Token Id the add the following line of code and add the token id into the database of the user.
  • To make the API Call the HTTP plugin must be added to the pubspec.yaml
  • To send the Notification Use the following lines of code.



As the push notification is such an important feature of the mobile application we will come up with a demonstration video ASAP to integrate the notification into the flutter applications.

I am an avid learner with holistic knowledge of software development and design. I make apps for Android and IOS