InvergeDocs
Flutter

Flutter SDK

nexus_flutter — one SDK for Android, iOS, Web, macOS, Windows and Linux. Install, initialise, configure, and the platform setup each product needs.

nexus_flutter gives a Flutter app every Nexus product from one Nexus.init, all correlated to the same session. Pure-Dart products run on every platform; native layers (shipped with the plugin) add device context, native crash capture, session-replay capture, foreground push display, Live Activities and the native call stack.

Install

pubspec.yaml
dependencies:
  nexus_flutter: ^1.10.0

The core products need no native setup. Push, Live Activities and Voice need the OS capabilities described on their pages.

Initialise

Call Nexus.init once, in main(), before runApp — not behind a splash or sign-in gate (incoming calls and deep links can launch the app in the background). Wrap the app in NexusScope (needed for session replay and context.nexus).

lib/main.dart
import 'package:flutter/material.dart';
import 'package:nexus_flutter/nexus.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Nexus.init(const NexusConfig(
    apiKey: 'nxs_live_xxx',
    appVersion: '2.1.0',
    // opt-in products:
    pushEnabled: true,
    remoteConfigEnabled: true,
    inAppEnabled: true,
    surveysEnabled: true,
  ));

  runApp(const NexusScope(child: MyApp()));
}

Nexus.init returns the instance; calling it again disposes the previous one. Nexus.isInitialized tells you whether it has run.

Accessing it

Nexus.instance.events.track('opened_cart');   // anywhere
context.nexus.events.track('opened_cart');     // under NexusScope

Services: sessions · events · logs · errors · flags · remoteConfig · links · realtime · replay · surveys · push · inApp · liveActivity · voice.

Configuration

Everything except apiKey is optional.

Identity

await Nexus.instance.identify('user_123', email: 'ada@example.com', name: 'Ada', traits: {'plan': 'pro'});
Nexus.instance.reset();   // sign-out

Lifecycle

On background the SDK flushes telemetry, pauses replay and (by default) disconnects realtime; on foreground it refreshes the session, drains the durable outbox, re-fetches surveys, in-app messages and Remote Config, and reconnects realtime.

await Nexus.instance.flush();   // everything, now
Nexus.instance.dispose();       // tear down

Dio

import 'package:nexus_flutter/nexus_dio.dart';

dio.interceptors.add(NexusDioInterceptor());   // replay Network tab

Product guides

Sessions · Events · Logs · Errors · Flags · Remote Config · Deep links · Realtime · Push · In-app · Live Activities · Surveys · Replay · Voice

On this page