Flutter

PushExpress -- SDK Flutter**

You will need to integrate your Push.Express account with Firebase.

Setup Firebase

  1. Go to Firebase Console and create a new project (or use existing one)

    You can use one project for all your apps.

  2. Open Project Settings -> General

  3. Create new Flutter app or just download google-services.json from existing app

  4. Install and run the FlutterFire CLI

  1. Then, at the root of your Flutter project directory, run this command:

  1. Add your app in firebase project

This automatically registers your per-platform apps with Firebase and adds a lib/firebase_options.dart configuration file to your Flutter project.

Setup Push.Express

Get Firebase Private key

  1. Go to Firebase Console and create a new project (or use existing one)

    You can use one project for all your apps.

  2. Open Project Settings

  3. Go to Service accounts, press Generate new private key and save it to file private-key.json (you can use same key for all apps)

Integrate your Push.Express App with Firebase

  1. Go to your Push.Express account

  2. Open existing App settings or create a new App

  3. Switch type application Firebase

  4. Paste private-key.json file to Firebase Admin SDK private key textbox

Add sdk in your application

  1. Import package in your main.dart file

  1. In main.dart add code for init Push Express sdk. Replace the default value of 12345-12 with the PULEXPRESS_APP_ID of your application. You can find out your PUSHEXPRESS_APP_ID in the Applications.

  1. Call initFirebase() in the initState() method in the main.dart file.

  1. Add a background push notification handler to Firebase Cloud Messaging in the main.dart file.

  1. Register the firebaseMessagingBackgroundHandler background push notification handler in the main() function of the main.dart file.

  1. Example of the main.dart file

Last updated