Skip to content

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

Sequenzy for Flutter

The official Flutter SDK for Sequenzy, the email marketing platform for SaaS. Identify contacts, track events, register push tokens and show in-app messages and content cards from Flutter apps. Pure Dart. Events from your app start the same sequences as your emails, and push and in-app messages are steps in them. Full guide: Mobile SDKs.

Install

dependencies:
  sequenzy_flutter: ^0.1.0

Use

import 'package:sequenzy_flutter/sequenzy_flutter.dart';

Sequenzy.configure(SequenzyConfig(
  publicKey: 'seq_pk_...',            // key with your app IDs under Allowed app IDs
  companyId: 'your-company-id',
  appId: 'com.example.app',
  platform: Platform.isIOS ? 'ios' : 'android',
  identityTokenProvider: (email) => myBackend.sequenzyToken(email),
));

MaterialApp(builder: (context, child) => SequenzyInAppHost(child: child!), home: ...);

await Sequenzy.identify(user.email);           // after sign-in; false for an invalid email
Sequenzy.track('workout_completed', {'minutes': 30});
// iOS needs the APNs device token (Sequenzy sends through APNs), Android the FCM token.
final pushToken = Platform.isIOS
    ? await FirebaseMessaging.instance.getAPNSToken()
    : await FirebaseMessaging.instance.getToken();
if (pushToken != null) await Sequenzy.setPushToken(pushToken);
FirebaseMessaging.onMessageOpenedApp.listen((m) => Sequenzy.handleNotificationOpened(m.data));
await Sequenzy.reset();                        // on sign-out

final cards = InAppCardsController();          // inbox: cards, refresh(), markRead(), dismiss()
InAppCardView(card: card, onDismiss: cards.dismiss);

iOS Live Activities need Swift for the widget and ActivityKit. Forward the tokens your Swift code or plugin receives so your backend can start, update and end activities through Sequenzy:

await Sequenzy.registerLiveActivityToken(
    LiveActivityToken.pushToStart(activityType: 'DeliveryAttributes', token: token));
await Sequenzy.registerLiveActivityToken(LiveActivityToken.update(
    activityType: 'DeliveryAttributes', activityId: 'order-1234', token: token));
await Sequenzy.liveActivityEnded(token);       // when the activity ends or is dismissed

On sign-out, end your running activities in native code before Sequenzy.reset(), so the next person never sees them.

Develop

flutter pub get && flutter analyze && flutter test
cd example && flutter run

Tests run against ../contract/fixtures. This repository is updated from Sequenzy's SDK sources with every release.

Links

Releases

Packages

Contributors

Languages