leanplum_flutter 0.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 58

leanplum_flutter #

A flutter plugin for the Leanplum SDK

Getting Started #

The Leanplum Flutter plugin allows you to access to the GDPR methods from the Dart code.

Nevertheless, the configuration of the SDK must still be done at the android and iOS app level.

A Flutter application is available on github to show you a concrete implementation.

You just have to clone the plugin repository https://github.com/pedroculque/leanplum_flutter, and open it with an android studio configured for flutter.

Add the plugin to your project #

  • Open the pubspec.yaml
  • add to the dependencies section

Initialize the SDK #

Follow the iOS and Android 10-15 minutes quickstart to initialize the SDK at the native app level.

Android #

Before following the previous tutorial. You need to open the application build.gradle and change two things :

  • You need to add the 'Firebase Messaging dependency to your application', to be able to initialize the SDK.
  • You need to add the Leanplum dependency to your application, to be able to initialize the SDK.
// Firebase messaging.
  // Minimum supported version of Firebase is 10.0.1.
  implementation 'com.leanplum:leanplum-fcm:5.3.3'
  implementation 'com.google.firebase:firebase-messaging:17.5.0'

  // Location services.
  // Only include if you need location-based messaging.
  // Minimum supported version of play location is:
  // 10.0.1 for FCM.


On Android, when you extend the default application you must use the FlutterApplication and not the default Application

public class FlutterApp extends FlutterApplication

iOS #

  • To 'enable Push Notifications' on iOS, you need to upload your certificates to Leanplum and register for remote notifications in your app.


First thing to do is to update the Podfile sources, you can add at the beginning of the file the following URLs:

  • source 'https://github.com/CocoaPods/Specs.git'

Then, you also need to set the minimum platform support to 8.0:

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'

Leanplum SDK flutter plugin uses a beta version of the SDK, please ensure that in your final Podfile

pod 'Leanplum-iOS-SDK', '2.6.4'

You're ready to follow the iOS tutorial.

Android push notifications #

To use FCM with Leanplum, you need to:
  1. Verify that your Gradle files include the correct FCM and Leanplum libraries (see above).
  2. Download your google-services.json config file (see how here).
  3. Add the above file to your root app/ folder.
  4. Copy your FCM Server Key. In the Firebase console, click the gear icon next to Overview, then click Project Settings.Then, in your project's settings, go to the Cloud Messaging tab. In this section of your settings, you will see your Server key.
  5. Copy the key.

Setting User ID #

The following method allow you to set a custom user ID in flutter layer.


Setting User ID #

The following method allow you to set a custom device ID in flutter layer.


0.0.3 #

  • Update readmen doc and iOS implementation

0.0.2 #

  • Beta of Leaplum Plugin and Doc

0.0.1 #

  • Initial version


import 'package:flutter/material.dart';
import 'dart:async';

import 'package:leanplum_flutter/leanplum_flutter.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  void initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initSDK() async {
    LeanplumFlutter.start(userId: '12345');

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        body: Center(
          child: Text('Leanplun SDK'),
        floatingActionButton: FloatingActionButton(
          onPressed: () {
          child: Icon(Icons.star),
          backgroundColor: Colors.green,

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  leanplum_flutter: ^0.0.3

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:leanplum_flutter/leanplum_flutter.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:leanplum_flutter/leanplum_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:leanplum_flutter/leanplum_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:leanplum_flutter/leanplum_flutter.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:leanplum_flutter/leanplum_flutter.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [leanplum_flutter] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

7 out of 7 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies