RTN Docs

Flutter SDK · Preview

Overview

Plan your Flutter integration with the RTN SDK, from installation to your first event.

Preview: planned API

The Flutter SDK is in development and not published yet. This page describes the API we are building so you can plan your integration. Package names, signatures and defaults may still change before the first release.

The RTN Flutter SDK sends app events to the same pipeline as the Web SDK. Customers who use your app and your store share one profile, so the same live segments reach them by email, push, SMS and WhatsApp and sync to your ad audiences.

Requirements

Flutter 3.22 or later (Dart 3.4). Android API 24+ and iOS 15+.

1. Install the package

pubspec.yaml
dependencies:
  rtn_flutter: ^0.1.0

2. Initialize the SDK

Initialize before runApp. The plugin wraps the native Android and iOS SDKs, so their behavior and limits apply. Use the write key of a mobile app from Apps in the RTN dashboard.

import 'package:flutter/widgets.dart';
import 'package:rtn_flutter/rtn_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Rtn.initialize(
    'WRITE_KEY',
    config: const RtnConfig(
      consent: ConsentState.pending,
      trackLifecycleEvents: true,
    ),
  );
  runApp(const ShopApp());
}

Initialization is non-blocking. Calls made before the SDK is ready are queued and sent once it starts, and no public method throws.

3. Send your first event

Rtn.track('newsletter_subscribed', {'source': 'footer'});

Events are batched on the device and survive restarts and offline periods. Open Events in the dashboard to see them arrive.

What the SDK collects automatically

With trackLifecycleEvents on (the default), the SDK records these events for you:

EventWhen it is sent
app_installedFirst launch after a fresh install, with install attribution
app_updatedFirst launch after the app version changes
app_openedEvery cold start and every return from the background
app_backgroundedWhen the app moves to the background
screen_viewedAutomatic screen tracking, or each screen call
deep_link_openedA direct or deferred deep link was handled
push_openedtrackPushOpened was called for a notification

Next steps

On this page