airship_flutter 3.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

Airship Plugin #

The Airship Flutter plugin allows using Airship's native iOS and Android APIs with Flutter apps written in Dart.

Usage #

  1. Add the airship_flutter dependency to your package's pubspec.yaml file:
  airship_flutter: ^3.0.1
  1. Install your flutter package dependencies by running the following in the command line at your project's root directory:
$ flutter pub get
  1. Import airship into your project:
import 'package:airship_flutter/airship_flutter.dart';

Android Setup #

  1. Download the Firebase google-services.json file and place it inside android/app.

  2. Apply the plugin to the android/app.

  3. Create a new file with your application’s settings and place it inside the android/app/src/main/assets directory:

   developmentAppKey = Your Development App Key
   developmentAppSecret = Your Development App Secret

   productionAppKey = Your Production App Key
   productionAppSecret = Your Production Secret

   # Toggles between the development and production app credentials
   # Before submitting your application to an app store set to true
   inProduction = false

   # LogLevel is "VERBOSE", "DEBUG", "INFO", "WARN", "ERROR" or "ASSERT"
   developmentLogLevel = DEBUG
   productionLogLevel = ERROR

   # Notification customization
   notificationIcon = ic_notification
   notificationAccentColor = #ff0000

   # Optional - Set the default channel
   notificationChannel = "customChannel"

iOS Setup #

  1. Add the following capabilities for your application target:
  • Push Notification
  • Background Modes > Remote Notifications
  1. Create a plist AirshipConfig.plist and include it in your application’s target:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  <string>Your Development App Key</string>
  <string>Your Development App Secret</string>
  <string>Your Production App Key</string>
  <string>Your Production App Secret</string>
  1. Optional. In order to take advantage of iOS 10 notification attachments, such as images, animated gifs, and video, you will need to create a notification service extension by following the iOS Notification Service Extension Guide

Example Usage #

// Import package
import 'package:airship_flutter/airship.dart';

// Tags
List<String> tags = await Airship.tags;

// Channel ID
String channelId = await Airship.channelId;

// Enable notifications (prompts on iOS)

// Events
    .listen((event) => debugPrint('Push Received $event'));

    .listen((event) => debugPrint('Notification Response $event'));

    .listen((event) => debugPrint('Channel Registration $event'));

    .listen((deepLink) => debugPrint('Deep link: $deeplink'));

Message Center #

Message Center support relies on Flutter's new mechanism for embedding Android and iOS views. As that mechanism is currently in a developers preview, the APIs may not be final.

To use the InboxMessageView on iOS, you need to opt-in for the embedded views preview by adding a boolean property to the app's Info.plist file, with the key io.flutter.embedded_views_preview and the value YES.

Example Usage

// Import package
import 'package:airship_flutter/airship.dart';

// Messages
List<InboxMessage> messages = await Airship.inboxMessages;

// Delete

// Read

// Events
    .listen((event) => debugPrint('Inbox updated'));

    .listen((event) => debugPrint('Navigate to app's inbox'));

    .listen((messageId) => debugPrint('Navigate to message $messageId'));

InboxMessage message = messages[0];

Widget build(BuildContext context) {
    return MaterialApp(
            home: Scaffold(
                appBar: AppBar(
                title: const Text('Message: $message.title'),
            body:  Container(
                child: InboxMessageView(messageId: message.messageId),
                height: 300.0,

Flutter Plugin Changelog #

Version 3.0.1 - March 23, 2020 #

Patch addressing a regression in iOS SDK 13.1.0 causing channel tag loss when upgrading from iOS SDK versions prior to 13.0.1. Apps upgrading from airship_flutter plugin 1.0.1 or below should avoid plugin versions 2.1.0 and 3.0.0 in favor of version 3.0.1.

  • Updated iOS SDK to 13.1.1

Version 3.0.0 - February 19, 2020 #

  • Refactored airship.dart to airship_flutter.dart to resolve publish warning. Customers upgrading to 3.0.0 will have to update their plugin imports accordingly, see readme for import instructions.

Version 2.1.0 - February 7, 2020 #

  • Updated iOS SDK to 13.1.0
  • Updated Android SDK to 12.2.0
  • Added number attributes support for iOS and Android
  • Added data collection controls for iOS and Android
  • Added screen tracking for iOS and Android
  • Improved cross-platform message view support

Version 2.0.0 - January 14, 2020 #

  • Renamed plugin package name from airship to airship_flutter
  • Updated iOS SDK to 13.0.4
  • Updated Android SDK to 12.1.0
  • Implemented attributes functionality in iOS and Android

Version 1.0.1 - December 9, 2019 #

  • Updated iOS SDK to 12.1.2
  • Fixed Airship events not properly deserializing in flutter

Version 1.0.0 - November 1, 2019 #

  • Initial release


import 'package:flutter/material.dart';
import 'package:airship_example/styles.dart';

import 'package:flutter/services.dart' show DeviceOrientation, SystemChrome;

import 'package:airship_example/screens/home.dart';
import 'package:airship_example/screens/settings.dart';
import 'package:airship_example/screens/message_center.dart';
import 'package:airship_example/screens/message_view.dart';

import 'package:airship_flutter/airship_flutter.dart';

// Supported deep links
const String home_deep_link =  "home";
const String message_center_deep_link =  "message_center";
const String settings_deep_link =  "settings";

void main() {


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

// SingleTickerProviderStateMixin is used for animation
class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  TabController controller;

  final GlobalKey<NavigatorState> key = GlobalKey();

  void initState() {
    controller = TabController(length: 3, vsync: this);

  static void addFlutterTag() {

// Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    Airship.onPushReceived.listen((event) {
      debugPrint('Push Received $event');

        .listen((event) => debugPrint('Notification Response $event'));

      const home_tab =  0;
      const message_tab =  1;
      const settings_tab =  2;

      switch(event) {
        case home_deep_link: {
        case message_center_deep_link: {
        case settings_deep_link: {

        .listen((event) => debugPrint('Inbox updated link'));

        .listen((event) => debugPrint('Show inbox'));

      key.currentState.push(MaterialPageRoute<Null>(builder: (BuildContext context) {
        return MessageView(messageId: messageId,);

    Airship.onChannelRegistration.listen((event) {
      debugPrint('Channel registration $event');

  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "Airship Sample App",
      initialRoute: "/",
      routes: {
        '/': (context) => tabBarView(),

  Widget tabBarView() {
    return WillPopScope(
        onWillPop: null,
        child: Scaffold(
          body: TabBarView(
            children: <Widget>[Home(), MessageCenter(), Settings()],
            controller: controller,
          bottomNavigationBar: bottomNavigationBar(),

  Widget bottomNavigationBar() {
    return Material(
      // set the color of the bottom navigation bar
      color: Styles.borders,
      // set the tab bar as the child of bottom navigation bar
      child: TabBar(
        indicatorColor: Styles.airshipRed,
        tabs: <Tab>[
            // set icon to the tab
            icon: Icon(Icons.home),
            icon: Icon(Icons.inbox),
            icon: Icon(Icons.settings),
        // setup the controller
        controller: controller,

Use this package as a library

1. Depend on it

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

  airship_flutter: ^3.0.1

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:airship_flutter/airship_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 Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/src/airship_flutter.dart.

Run flutter format to format lib/src/airship_flutter.dart.

Format lib/src/attribute_editor.dart.

Run flutter format to format lib/src/attribute_editor.dart.

Format lib/src/inbox_message_view.dart.

Run flutter format to format lib/src/inbox_message_view.dart.

Maintenance suggestions

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.


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