InvergeDocs
FlutterAPI reference

Session replay

Session replay in the Flutter SDK.

import 'package:nexus_flutter/nexus.dart';
import 'package:nexus_flutter/nexus_dio.dart'; // NexusDioInterceptor
SymbolKindSummary
NexusReplayclassSession replay.
NexusMaskclassRedact a widget from session replay.
NexusNavigatorObserverclassReports route changes to Nexus so session replay's Pages tab shows the screens a user moved through.
NexusDioInterceptorclassA Dio interceptor that feeds every request into session replay's Network tab — method, URL, status, duration and response size.

NexusReplay

class

Session replay. Captures the app as rrweb-compatible screenshot frames + pointer events via NexusReplayController (Flutter-side, all platforms) and ships them to /partner/replay, correlated to the session. Also accepts batches from a native recorder if one is present (future native SDKs).

View source

isRecording

property
bool get isRecording
View source

controller

property
NexusReplayController get controller

The Flutter capture engine — used by NexusScope to install the RepaintBoundary and forward pointer events. Internal.

View source

start()

method
Future<void> start()

Start capturing the session.

View source

stop()

method
Future<void> stop()

Stop capturing and flush any buffered events.

View source

pause()

method
void pause()

Pause/resume capture (called around app background/foreground).

View source

resume()

method
void resume()
View source

trackScreen()

method
void trackScreen(String name)

Record a page/route change (populates the player's Pages tab). Usually wired automatically via NexusNavigatorObserver; call manually for custom navigation. No-op when replay is disabled.

Parameters

Prop

Type

View source

observeRouter()

method
void observeRouter(Listenable router, String Function() currentPath)

Track navigation from a Listenable router + a current-path getter — e.g. GoRouter (catches shell/nested routes a root observer misses):

nexus.replay.observeRouter(
  appRouter.routerDelegate,
  () => appRouter.routerDelegate.currentConfiguration.uri.path,
);

Parameters

Prop

Type

View source

recordNetwork()

method
void recordNetwork({required String url, required String method, required int status, required int durationMs, int? size})

Record a network request for the player's Network tab — feed this from your HTTP client's interceptor (e.g. a Dio interceptor). No-op unless recording.

Parameters

Prop

Type

View source

flush()

method
Future<void> flush()
View source

dispose()

method
void dispose()
View source

NexusMask

class
class NexusMask extends StatefulWidget

Redact a widget from session replay. The wrapped subtree renders normally to the user, but its on-screen area is painted over with a solid block in every captured replay frame — so sensitive pixels (card numbers, tokens, PII) never leave the device.

NexusMask(child: Text(order.cardNumber))
View source

NexusMask

constructor
const NexusMask({super.key, required this.child})

Parameters

Prop

Type

View source

child

field
final Widget child
View source

NexusNavigatorObserver

class
class NexusNavigatorObserver extends NavigatorObserver

Reports route changes to Nexus so session replay's Pages tab shows the screens a user moved through. Add it to your app's navigator:

MaterialApp(
  navigatorObservers: [NexusNavigatorObserver()],
  ...
)

Uses each route's settings.name, so name your routes (or push with RouteSettings(name: ...)); unnamed routes fall back to a generic label. For custom navigation, call context.nexus.trackScreen('...') directly.

View source

didPush()

method
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute)

Parameters

Prop

Type

View source

didReplace()

method
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute})

Parameters

Prop

Type

View source

didPop()

method
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute)

Parameters

Prop

Type

View source

NexusDioInterceptor

class
class NexusDioInterceptor extends Interceptor

A Dio interceptor that feeds every request into session replay's Network tab — method, URL, status, duration and response size.

import 'package:nexus_flutter/nexus_dio.dart';

dio.interceptors.add(NexusDioInterceptor());

A no-op until Nexus is initialised and replay is recording. Add it last so it observes the final request/response (after your auth/retry interceptors).

View source

onRequest()

method
void onRequest(RequestOptions options, RequestInterceptorHandler handler)

Parameters

Prop

Type

View source

onResponse()

method
void onResponse(Response<dynamic> response, ResponseInterceptorHandler handler)

Parameters

Prop

Type

View source

onError()

method
void onError(DioException err, ErrorInterceptorHandler handler)

Parameters

Prop

Type

View source

On this page