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.
- Package
nexus_flutter1.10 · Dart 3.13+ · source - API reference — every class and method.
Install
dependencies:
nexus_flutter: ^1.10.0The 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).
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 NexusScopeServices: sessions · events · logs · errors · flags · remoteConfig ·
links · realtime · replay · surveys · push · inApp · liveActivity ·
voice.
Configuration
Everything except apiKey is optional.
| Field | Default | |
|---|---|---|
apiKey | — | nxs_… key; sent as x-api-key and in the socket handshake |
appVersion | — | Reported with telemetry |
defaultProperties | {} | Merged into every event and person context |
autoTrackSessions | true | Start and keep a session automatically |
autoCaptureErrors | true | Report uncaught Flutter / Dart / native errors |
flushInterval | 10 s | Batch cadence for events and logs |
maxBatch | 50 | Items per flush |
flushOnBackground | true | Flush when the app is backgrounded |
logLevel | warn | SDK diagnostics (logging: true = debug) |
onLog | — | Receive every SDK log record |
| Field | Default | |
|---|---|---|
autoConnectRealtime | false | Connect at startup (connection minutes are billed) |
manageRealtimeWithLifecycle | true | Disconnect in background, reconnect and re-join on foreground |
| Field | Default | |
|---|---|---|
remoteConfigEnabled | false | Fetch at startup and on foreground |
remoteConfigRealtime | false | Re-fetch live when a template is published |
remoteConfigDefaults | {} | In-app defaults |
| Field | Default | |
|---|---|---|
pushEnabled | false | Turn-key: permission, token, registration, refresh, open tracking |
pushAutoRequestPermission | true | Ask at init; set false and call push.start() later |
pushForegroundDisplay | true | Show notifications while the app is open |
pushAndroidChannelId / pushAndroidChannelName | nexus_default / Notifications | Match your server-side channel id |
pushWebVapidKey | — | Web only |
| Field | Default | |
|---|---|---|
inAppEnabled / inAppAutoShow | false / true | |
surveysEnabled / surveyAutoShow | false / true | |
autoShowOverlay | true | Mount the overlays automatically (no MaterialApp.builder) |
| Field | Default | |
|---|---|---|
linksEnabled | true | Automatic install / open attribution |
linkDomains | [] | Branded short-link hosts |
autoRouteDeepLinks | true | Route deferred and short-link opens |
onDeepLink | — | Return true to take over a link |
| Field | Default | |
|---|---|---|
replayEnabled | false | Needs NexusScope |
replayInterval | 1 s | Frame cadence; identical frames are dropped |
replayPixelRatio | 1.0 | Capture resolution |
replayMaskTextFields | true | Redact every text input |
replayCaptureConsole | true | debugPrint → Console tab |
replayCaptureNetwork | true | HTTP (Dio and package:http) → Network tab |
| Field | Default | |
|---|---|---|
liveActivityEnabled | false | iOS ActivityKit + Android Live Updates |
voiceEnabled | false | Calling with the native call UI |
Identity
await Nexus.instance.identify('user_123', email: 'ada@example.com', name: 'Ada', traits: {'plan': 'pro'});
Nexus.instance.reset(); // sign-outLifecycle
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 downDio
import 'package:nexus_flutter/nexus_dio.dart';
dio.interceptors.add(NexusDioInterceptor()); // replay Network tabProduct guides
Sessions · Events · Logs · Errors · Flags · Remote Config · Deep links · Realtime · Push · In-app · Live Activities · Surveys · Replay · Voice
