How To Send OneSignal Firebase Notification in Flutter

Getting Started With the OneSignal

Step 1: App Registration with OneSignal.

  • Register an account at OneSignal.
  • Click on Add a new app. Select the android and Fill in the name of the app and click configure your platform.
  • Click On Configure your Platform.

Step 2: Add the firebase server Key and sender id.

  • To find the firebase server key and the sender id go to your firebase console.
  • open the project->project setting and select the Cloud Messaging. Then you find the server key and sender Id.
  • Now fill in the server key and the sender id and click on the Save & Continue.
  • Then Select the platform as Flutter and continue. then Click on Done.
  • Now in the OneSignal website navigate to the Settings->Keys & IDs to find your App Id and Rest API Key

Step 3: Integrate the one signal to your Flutter App.

  • Add the one signal Plugin to the pubspec.yaml file and run Pub get.
  • Navigate to android->app->build. gradle and add the following lines of code.
buildscript {
    repositories {
        // ...
        maven { url '' } // Gradle Plugin Portal
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath '[0.12.6, 0.99.99]'

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
  • Initialize the one signal by adding the following line of code in the init state of the main. dart file of your project.
  void initState() {

  void configOneSignel()
  • Build your App Now, This would register a user on the one signal.
  • After building the flutter application check the dashBoard on the OneSignal website to view the subscribed users.

Step 4: Go to the Message in the OneSignal page and make a notification.

  • Click the Send Message button.



Leave a Comment

Your email address will not be published. Required fields are marked *