How to Add Push Notifications to a Flutter App
Tags: mobiledev, flutter, dart, programmer
Published: 2022-04-05 16:55:35

---
title: How to Add Push Notifications to a Flutter App
published: true
date: 2022-03-14 18:35:30 UTC
tags: mobiledev, flutter, dart, programmer
canonical_url: https://onesignal.com/blog/how-to-add-push-notifications-in-flutter-with-onesignal/
---

 ![How to Add Push Notifications to a Flutter App](https://onesignal.com/blog/content/images/2022/03/how-to-add-push-notifications-to-a-flutter-app.jpg)

Push notifications have proved to be one of the most effective ways to enhance your user experience, improve app engagement, and boost retention. In this tutorial, we’ll show you how to integrate [push notifications](https://onesignal.com/mobile) in your iOS and Android apps with minor configuration changes using the [OneSignal Flutter SDK](https://documentation.onesignal.com/docs/flutter-sdk-setup). In no time, you'll be able to send out transactional and promotional push notifications to users for free!

If you are a Flutter developer and want to leverage push notifications to engage with your users, follow along to add this amazing functionality to your apps.

### Guide Overview: 

- **[Part 1: Set Up Your OneSignal Account](#part-1-set-up-your-onesignal-account)**
- **[Part 2: Creating a Flutter App](#part-2-creating-a-flutter-app)**

## Part 1: Set Up Your OneSignal Account

To begin, [log in](https://app.onesignal.com/login) to your OneSignal account or [create a free account](https://app.onesignal.com/signup). Then, click on the blue button entitled _ **New App/Website** _ to configure your OneSignal account to fit your app or website.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/SuayEKKWaLijFKYhGF4ijppOJqfprFUswRNI6DTWaLimqGtYmG55d-yYIw2DmIog9_X674_h3c7NW0ITCET5rdGBnzC1eZ8ycxsbkzqFMry8LPLSFNqg-eDguOkaf4PArmRe2FIC)

Add your app name, select _ **Google Android** _ if the target is Android devices or select _ **Apple iOS** _ if the target is iOS devices. Then click, **_Next: Configure Your Platform_**.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/W9bhSNrbKFrkTMfVcxScu5x2GzRVj9_T7cVnkQKtlHU_V5_BFkHRsV2jkXaJD9BfulmUSVhYK26xDfEzXPqy2mw4RKBFE99vd87FVHBnrjf-CFGiDXWhN1-ymH-2-PzNFCx58rUK)

For iOS, you will need to **add an iOS push certificate**. If you're not sure about this step, read OneSignal's [instructions on how to generate an iOS push certificate](https://documentation.onesignal.com/docs/generate-an-ios-push-certificate).

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/SS9EXmNZn6BPiaVQZaDUvNHWVH8Ba9IaoVKWlu0B1Wzc-52TK5IoJbhsomskMQ1tjsa2yBpFAMtgr72VB3AppQuI-LWhrccmNL7958EhKBZc4gs_Ee-N5WItgFxLxdbcTabp6P1m)
_Apple iOS (APNs) Configuration in OneSignal_

For Android, you will need to enter **Firebase Server Key** and **Server ID** that you can get by creating a new project on Firebase Console.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/QSh1iDrnoIL5yuThK1hKjbHU67sxkuVLC4WtTjwLQ3TDnTE1sM6rsYtso3GmUo7VtbZ98o5byyRYlLm5M3OVW-Cynb4TeIfz4GfWlkUFtS2o-hv4szJ7GjKFmDAsH5A5NDJ7m_Fo)
_Google Android (FCM) Configuration in OneSignal_

To find the Firebase service key, log in to the Firebase console and click on **_Add Project_**.

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/HCgbFkPibXItPV_rMXZ4I5UhZ_VMJdLvDTvLkSOwWNbTUSz3pcUzjkymdFuFWhRcCQZ1wlpFIwAKltrc4zr6GzwXaHTtHe3Wnqbh4mwzaetwkeM15Vtpe4fLmEpqO-Q0f8ECuw4I)

Add the name of your project and turn off **_Enable Google Analytics for this project_** if you want,  then click on **_Create Project_**.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/7NimhzKwTi82XolqEwokp2pL_wU7vf2glRxVp6ldi4KQhKVu5zhXyB4IMzBS6qTxuibP3IEijZYRzLoDj-yQZUjvXY88yQQlsXYejTdxP-olVQ91GqE-TqSEn_VDBv3wUIxIF3Fc)

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/NOI1N2J8u3Bip_-PzMNTvO2gvH49U0q77YKtHvu3JNXxZUMELoTrsAgFQEC_CVIchdW8mYMs5e8iYKT7sDyUyoOqSJgbapCZhKsp7ReAK9BtKCBg6eK-HV1TkN5oYkGBdYLqhcpu)

Click _ **Create project** _ to save the new entry, then click _ **continue** _.

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/R3gzEUHXu6FLVzT4YA3yE2rq7t9FlJEwKeueprwAFRhXF-cT5MxaTD-H-gOoPzypzBAIqPbAnnSDTfrOmpXUfKm31_u-PjCMVS-tVnyDWMzf2yhLoGureWuAl029DYUETpRC6Wlz)

You’ll be directed to the project dashboard where you have to click on the Setting icon next to _ **Project Overview** _ and click on _ **Project Settings** _ from the menu that appears.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/xgBbRkPvoy5yrtjZgPrT_RHDWm2TnlJiQsMu2eHMid8ZrDjwuAtbQVfrNmdov-ZgVQfdeHphFFpcVLV7vXDafHApaj6QS8_VKcaU0SgVUTPwBekHbRiOQg4_KOIrhF1knue18zB5)
_Navigate to the project settings menu in the Firebase console._

In the **_Cloud Messaging_** tab, you’ll be able to find the **_Firebase Server Key_** and **_Server ID_**. Navigate back to your OneSignal dashboard and copy and paste those values into the appropriate fields under **_OneSignal Google Android(FCM) Configuration_** like this:

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/ASOexI_mhJTL_5onk8wRc9V2vf1IMGT2ENa5dHo6E7nkrx0YqVCTkwWdLD9rCohZwWbKkOzvJv-GidMq7i6kw2ZwXsd1qGhPlvHxjZGSuCrF-4Y4EsIrvT1VH8KUTtgGLMvoGJNg)
_Input your Firebase Server Key and Sender ID in OneSignal._

After clicking on **_Save & Continue_** , you’ll be asked to select your target SDK. Choose **_Flutter_**.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/WccnkK7Gq2_BySBjkOYOt05_ELqpNySyF-ILU4-rkt1T5pUgBFemOV8IKS8DKZQHC9aLH6vUNcj5QEYyS_0dK5EB4W-vJqKCjilpFwh2Zj1YvH3o20TVp7OFpaNp7lkYyH5j8AxB)
_Choose Flutter as your target SDK._

Click **_Save & Continue_** again and then click **_Done_** at the bottom of the screen.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/SYLtgXBKUAImb3MNUWVAoO0VuzFuSJw9-ZQ9OarySTix_pYGiniLb10SueR0-LAEtW7W8rsjmfRHvMVUQuSvVGs6YREP1gvzXs9R_Phs0rgeyzhz2insoyqxR0CuCdQth4vEaHWO)
_View your app ID in OneSignal to finish the Google Android FCM configuration process._

Now, you should see your app dashboard on OneSignal under the _ **Settings** _>_ **Platforms** _ tab. On this page under _ **Native App** _ _ **platforms** _, you should see an **_Active_** tag next to _ **Google Android,** _ which means you’re ready to send notifications to users using the Android version of your Flutter app. If you followed the iOS setup, you should see an _ **Active** _ tag next to _ **Apple iOS** _.  

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/dfx8y7Ye_Ce1QSPauqCq4s9ULg8MDI6vA8_dkjjFMB3-vgOWyGvRfWZSIA5GRFx7qwIFNf88OkEZ71R6V0Xtd1DcwpFeIUBOck3VFkdHz3Ck3Sf3-dW3IeJ4d9chg08Ur5HPei5U)
_An "Active" tag is displayed next to Google Android in the OneSignal dashboard._

## Part 2: Creating a Flutter App

So the first thing you need to do after creating a new Flutter project is to add the `onesignal_flutter` dependency. To do that, visit [pub.dev](https://pub.dev/) and search for **_onesignal\_flutter_**.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/b6AGMy9QnDBPYEgM4Eb5ik9UbU6Dis24p3W2-VhGAo7PUUwT7ekALaYP1CY_lQBeFvA5j6QovvAErgLmzQKuvyJ_0wixkiLsqPM43VbwWYzyUnlKV-YrsLrPXgCbcqDPwVrQ0ZXv)
_Shows onesignal_flutter 3.2.7 in pub.dev._

Add the latest version of `onesignal_flutter` to `pubspec.yaml` under the dependencies section with the version number from pub.dev.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/Wp19ZvWDqfDQLnCkiaoCMbmMoqn-4D7LjHSVn03MdclYlQek5_3fA_WliBvaA1ceFvrL2rseaK0PJ2uytpodAL_hkalirkQb1ShSsq1r51uvtUqYj5uGEodXSdJJUR6efEZfBEUE)

Now open `main.dart` and remove `MyHomePage()` class (or just its contents).

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/9vBLaNXdBvwEfBfJV5WrZXHpkUob1UffT3-t7BHSuGqtM5QGxcK3BEEs7LCTHH0mqSAOXZ5PhKbbrfmpYIRKMgL4BBRsyM000KzTL481jKF2Dynf28eKoFJZkLaOvqMMuzNtlAAB)
_Remove the content of MyHomePage() from main.dart._

Create a new dart file named `home.dart` (or continue in the `main.dart` file) and create a stateful widget by the name `Home` like this:

```
class Home extends StatefulWidget {
const Home({Key? key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Container();
}
}
```

Next, build a simple UI by adding a few widgets like `Container`, `Column` and `Text` in the `Home class`.

```
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: const [
Text("Hello"),
],
),
),
);
}
```

Now you can add the **_OneSignal App ID_** which you can find in your OneSignal dashboard under the **_Keys & IDs_** tab.

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/yqe9Or5bCachnjJN4PJeDNgV4gRnNdj0aTgCnQxewYEHX5u2n3gtfDK-Ie49aP0lnrY0ULOAmxPnPtdIcnABwKiO8dT8JSnPjcFkkyrUDYTYZqwZJc7gdtdbAtXHjBnQfcPuSElA)

Copy the **_OneSignal App ID_** and add it into your Flutter app in `main.dart` as a constant.

```
static final String oneSignalAppId = "16090413-4b70-4c0b-a9f4-dd43c445ccee";
```

Then add SDK initialization code to your `XXX`.

```
Future<void> initPlatformState() async {
   OneSignal.shared.setAppId(oneSignalAppId);
   OneSignal.shared
       .promptUserForPushNotificationPermission()
       .then((accepted) {});
 }
```

Also, initialize state.

```
@override
 void initState() {
   super.initState();
   initPlatformState();
 }
```

### Complete Code(main.dart)

```
import 'package:flutter/material.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
 
class Home extends StatefulWidget {
 const Home({Key? key}) : super(key: key);
 
 @override
 _HomeState createState() => _HomeState();
}
 
class _HomeState extends State<Home> {
 @override
 void initState() {
   super.initState();
   initPlatformState();
 }
 
 static final String oneSignalAppId = "16090413-4b70-4c0b-a9f4-dd43c445ccee";
 Future<void> initPlatformState() async {
   OneSignal.shared.setAppId(oneSignalAppId);
   OneSignal.shared
       .promptUserForPushNotificationPermission()
       .then((accepted) {});
 }
 
 @override
 Widget build(BuildContext context) {
   return Scaffold(
     body: Container(
       child: Column(
         mainAxisAlignment: MainAxisAlignment.center,
         crossAxisAlignment: CrossAxisAlignment.center,
         children: const [
           Text("Hello"),
         ],
       ),
     ),
   );
 }
}
```

Run your Flutter app on your physical device or emulator.

In case you recieve `compileSdkVersion error` then go to your `app-level build.gradle` file and update `compileSDKVersion` to **31**.

```
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.flutter_onesignal"
minSdkVersion 16
compileSdkVersion 31
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
```

If you get `Kotlin Version error` then go to your `build.gradle` file in the root of your Android directory and upgrade your `Kotlin_version` to the latest version (`ext.kotlin_version = '1.5.10'`)

For the iOS version, there’s are some additional steps that need to be completed. The first one is to add an iOS service extension.

The OneSignalNotificationServiceExtension allows your application (in iOS) to receive rich notifications with images and buttons, along with badges and [Confirmed Deliveries](https://documentation.onesignal.com/docs/confirmed-deliveries).

The first step is to navigate to your Flutter project's iOS folder and open the `.xcworkspace` file in Xcode. You can use the `open ios/Runner.xcworkspace` command in the terminal to do the same.

Then select **_File_** > **_New_** > **_Target_**.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/2ahVy90kNsCUL-FvxQhdZnD_1BMhepqGL27kHRoiawMzuYssIT0jYtMIPxLm3-iJkAcioce66I_RJj4hAYqI7RGLmNCf5xC9iNy8YJy1ZYdIIJpcHizth0GeSB3wOgxpGfuQ9xpK)

Select **_Notification Service Extension_** and press **_Next_**.

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/-HhMpA3cmMlEDakFbw55JB1QVkHfpYDG-aUYtrqLYfZc9GQJrsXVSmfuKRGBUkouYNm-MOoyLNV6DPi8Jzh6SmBKAqv5bSzL4e-TkA0ksFLt3UHDjt0OEbaPODqYxfjZ8AcjWCDP)

Add the product name as **_OneSignalNotificationExtension_** and change the language to _ **Object-C** _ or **_Swift_** according to your needs. The team account should be your account or your organization’s account.

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/1akC8xbAiWfhyifJMOCqso3-eW9m3hhHcpRGqu4qanre1Q997EIPGvP5yN0VJFjxJkgfeDN24oAd6z_-NIDQ0S3yUEhtiTQUTHIRISxaBg5R-fQiFPsj7cxeTkJ4FArjOnz3BRDE)
_Add the product name as OneSignalNotificationExtension in Flutter._

Click the _ **Finish** _ at the bottom right corner of the window, but when prompted to “Activate” scheme click on _ **Cancel** _.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/_lrzrxMW6I41eYSoPBx5kGdmk2j1HYCZHr64toNYOzwFevPFi68e8zZez_hw4Feqzido91O5Ks_c5CYe8s0BjYfFwCCZG21g332n-X53JqjujSIRjeH5qZovFnQj8k0XYf_H3UaP)
_Click "Cancel" when prompted to activate the scheme._

By canceling, you are keeping Xcode set to debug your app rather than using the extension. If you select _ **Activate** _ by accident, you can simply switch back to debug your app in Xcode (next to the Play button).

Now, open the Xcode project settings and select the _ **OneSignalNotificationServiceExtension** _ target. Under the _ **Deployment info** _ section on this page, select iOS 10.0 as the target unless there are any reason for using higher versions.

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/pm2Nwawvmko5SA50hUUKzzLEdWA4yVF83qTSk4ORSLGgu7xWVY2ahRKiNls8xidSL6wcI2E4SchyoRr0nzpUnaS9bCBBzN0iDWCYmaSock0CRJrDLBplqx3Wxs6g6ZqlhOBXUYIw)

Now, close the Xcode project and go back to your Flutter development IDE. In the `/ios` directory of your project, open the **_Podfile_** and add the following lines outside of the main target (they should be at the same level as your main target):

```
target 'OneSignalNotificationServiceExtension' do
use_frameworks!
pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
end
```

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/YYa5t-_B9sK-Ca-tdjFUxSfnB0iumq7FPZ86YKkJty66WTyw5liQTv_dKyjcznYXOhxOvG2SYUfKZ7yvmzZWjP7uau9CzHdmicoWKIbWnpAL4Hwy8TOr-VUrBK0V5KTt6T8Hq0K_)

Also, make sure to uncomment the platform line at the top of the **_Podfile_.** It can be iOS version 9.0 or higher according to your needs.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/kbNDzO4R_o82ntNP04yqr07iV1ajyFDc3TQsqq07dNfbR77ZvI_2aV8oDdNNDIN1_PBHXD4CsFkQlnS7hzmLBGAjwCXp_6bO6y61QkwxG4_Jv40aENiwASNujDLTM2OfxXLd-JH7)

Now Open the terminal, cd to the ios directory, and run pod install.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/bMNOc-BQBzq0F19UZg-Q2ctZGX2M43GB3xLx5pgnOEOZLn2PNXiNotZGZ0vkXng0c8M-qkE_Vd8cc2NqMEwQVbDBW6tRioxz7XS9TrEJlOkRGdFaXeMf4_ChF6hppuQ13dWFnjW9)

If you see the error below, remove `#` from the above in front of `use_frameworks!` and try again.

`- Runner (true) and OneSignalNotificationServiceExtension (false) do not both set use_frameworks!.`

Open the `<project-name>.xcworkspace` file. In your project, in the `OneSignalNotificationServiceExtension/` folder, open `NotificationService.m`.

![How to Add Push Notifications to a Flutter App](https://lh4.googleusercontent.com/6LNQ1cUOlh4Wsp4rVr6Y1wgVPtDCRpgOR48BWeTqtoOHrEoUGHReEyN5sVJfha1SqbEa1tV4G0KAqnHhSQxvvb8-oNttLBTGk6EKvSAQhtgfjta_N5EmFqln7Bg0anT_c7HxUVp4)

Replace the whole file contents with the following code for Objective-C:

```
#import <OneSignal/OneSignal.h>
#import "NotificationService.h"
@interface NotificationService ()
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
@property (nonatomic, strong) UNNotificationRequest *receivedRequest;
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
@end
@implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
   self.receivedRequest = request;
   self.contentHandler = contentHandler;
   self.bestAttemptContent = [request.content mutableCopy];
  
   //If your SDK version is < 3.5.0 uncomment and use this code:
   /*
   [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest
                      withMutableNotificationContent:self.bestAttemptContent];
   self.contentHandler(self.bestAttemptContent);
   */
  
   /* DEBUGGING: Uncomment the 2 lines below and comment out the one above to ensure this extension is excuting
                 Note, this extension only runs when mutable-content is set
                 Setting an attachment or action buttons automatically adds this */
   // NSLog(@"Running NotificationServiceExtension");
   // self.bestAttemptContent.body = [@"[Modified] " stringByAppendingString:self.bestAttemptContent.body];
  
   // Uncomment this line to set the default log level of NSE to VERBOSE so we get all logs from NSE logic
   //[OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
   [OneSignal didReceiveNotificationExtensionRequest:self.receivedRequest
                      withMutableNotificationContent:self.bestAttemptContent
                                  withContentHandler:self.contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
   // Called just before the extension will be terminated by the system.
   // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
  
   [OneSignal serviceExtensionTimeWillExpireRequest:self.receivedRequest withMutableNotificationContent:self.bestAttemptContent];
  
   self.contentHandler(self.bestAttemptContent);
}
@end
```

For Swift, replace it with:

```
import UserNotifications
 
import OneSignal
 
class NotificationService: UNNotificationServiceExtension {
  
   var contentHandler: ((UNNotificationContent) -> Void)?
   var receivedRequest: UNNotificationRequest!
   var bestAttemptContent: UNMutableNotificationContent?
  
   override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
       self.receivedRequest = request
       self.contentHandler = contentHandler
       self.bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
      
       if let bestAttemptContent = bestAttemptContent {
           //If your SDK version is < 3.5.0 uncomment and use this code:
           /*
           OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
           contentHandler(bestAttemptContent)
           */
          
           /* DEBUGGING: Uncomment the 2 lines below to check this extension is excuting
                         Note, this extension only runs when mutable-content is set
                         Setting an attachment or action buttons automatically adds this */
           //OneSignal.setLogLevel(.LL_VERBOSE, visualLevel: .LL_NONE)
           //bestAttemptContent.body = "[Modified] " + bestAttemptContent.body
          
           OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler)
       }
   }
  
   override func serviceExtensionTimeWillExpire() {
       // Called just before the extension will be terminated by the system.
       // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
       if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
           OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
           contentHandler(bestAttemptContent)
       }
   }
  
}
```

You also need to enable an **App Group** to use [Confirmed Deliveries](https://documentation.onesignal.com/docs/confirmed-deliveries) and increment/decrement [Badges](https://documentation.onesignal.com/docs/badges) through push notifications. For that, you can follow the [iOS SDK App Groups setup guide](https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup) to add the OneSignal App Group in your app.

Now you need to enable **push capability for iOS apps**. Open your `.xcworkspace file` in Xcode.

In the main app target, select **_Signing & Capabilities_** > **_All_** > **_+ Capability_** and then search "push." Double-click on _ **Push Notifications** _ to enable it.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/DWJI_pmSWCdbnZCYSqZbJRjrQk1qfmCaT1KHQRTxeTfVJBBKgL9_AVB6j4SdLjTsZEymjfrXu9orM9T7NzfxFQew2_yI6H_TCgtjk4RlpXSKi9d-jldSLpRL93ozoRPMbOmfttcX)

Next, enable **_Background Modes_** and check **_Remote Notifications_**.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/oaedkTvazpCH9OaAEJ2mTnEH1k5KCcDkuDEWzBgQTSIRUNa1gUJji9G9ljuXsZEXIhctWjSPIG5sUY4TKx28dn7juuDPrA8BHSU1H-a51Kdr7157o-PLOKLovp6w7mIJT-5zuppa)

Now you are ready to send notifications from the OneSignal dashboard!

Back in your OneSignal dashboard, click on **Messages** in the top navigation menu and select _ **Push** _ from the sub-menu. Click the **_+New Push_** button to create your first notification.

**Note:** Notifications are enabled on Android devices by default if you have disabled your notifications, make sure you [enable them again](https://support.google.com/android/answer/9079661?hl=en#zippy=%2Coption-show-all-notifications). If you're sending a notification to an iOS device, you will need to opt-in to notifications in your app settings.

![How to Add Push Notifications to a Flutter App](https://lh3.googleusercontent.com/q5c86f4bIcxmL3rgkG-z-82Go1BiAnOQMLniEecZZBe0rUUewtF8bBY_HuXB83HDS2_AqkBIuvZjn9QoohdwVJAwwM8Sjb-tBD4VSaSyRbxwWm6KrEClQg7wJeR85dSHl8bUe8o_)
_Click the "+New Push" button in your OneSignal dashboard._

You will be redirected to a new window that will allow you to customize your push notification. Under _ **Audience** _, make sure that _ **Send to Subscribed Users** _ is selected. Then, create your message by adding your message title, content, and image. Because this is the first notification your subscribers will receive, you may choose to craft a simple welcome message to confirm that they've been subscribed and reinforce the value that notifications will provide.

Under the _ **Delivery Schedule** _ section, select _ **Immediately** _ and _ **Send to everyone at the same time** _ to send to all your current push **subscribers**. If you have just finished setting up your OneSignal account, chances are you're the first and only **subscriber**. If your app or website is heavily trafficked and other users have already opted in to receive push notifications, you may want to select _**Send to a particular segment(s)**_ to test your message out on a specific audience.

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/DniDr03ChMf0gKDZF5slIh9qavCZlMNmm4yFdDHQS4Jowjh2NP3NzJ-Qyf8SfR-5am7PUbkY5dy0TlIXj7RxuQox8UAWvGs4Wnmn5W752ISgtaO1pCw-ENOiRC5JZF2poo1Q2aUr)
_Specify the audience for your push notification in OneSignal._

Add your message title and copy and preview how your message looks on your target device.

![How to Add Push Notifications to a Flutter App](https://lh5.googleusercontent.com/9xiwSSoMPYiEmP0i67DsfmKl5RskyDhPCPxiKkBgIIpRHE0u37n3XFakDxcwIpT5g8IPVCTRv5EPpJke1H25dFd2IKe9MG-mMHl_0Cuh7bLcrOoj_9WMpTlckRZKU1p0gCQU01u3)

When you're ready to send your message, click on the blue _ **Review and Send** _ button at the bottom of the screen.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/34f-jBgJ13ypRXN0N_FoonL73H8qScgqUENeOPK6hp7MU4fGyn0KCeAsftUlB71jh5kdQwuiQP5_Rw5nH7IL60nUrkV-DFBo7EABsKnDMRg-P9UC-S6pqrCkBGmhnCj0tb7D1AhF)

A small popup will appear for you to review your message. Once you are satisfied, click on the blue _ **Send Message** _ button. You should receive a push notification on your device! 🚀

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/gHVM6DAHNffI_bTGhz1SRB5Sa0bxQUkTCrclZpn6vDALkUpjegZspNGOFBHz0jwZmiQpAup_xDBlXmFg1EURwCVRW0S5bramwtss3rH6GJWRZCjjylW24ZaIuhkHjbKjPOwMWkZG)

You’re done **🎊**!

You’ll receive the notification on your physical device that you used to run your Flutter app or on the emulator.

![How to Add Push Notifications to a Flutter App](https://lh6.googleusercontent.com/Sbz_v6cItylXPlj4D2BvbajJwSX_uGXsvOsriLB9ZjWs4tgB6gmXJrJOaGOWWwN9VccqZMPlJDCLqvuxI5TuRZPLI5ZUGpaoiuTXiqt6Pz49-DGH3V3sVlF2gERENOXgUqE_TMve)

After the message sends, you'll be directed to the **_Delivery_** page where you can view the send report and track engagement.

### Still have questions?

Check out our complete [OneSignal Flutter SDK Documentation](https://documentation.onesignal.com/docs/flutter-sdk-setup).

This post was guest authored by **Akanksha Singh**.