Session replay
Session replay in the Flutter SDK.
import 'package:nexus_flutter/nexus.dart';
import 'package:nexus_flutter/nexus_dio.dart'; // NexusDioInterceptor| Symbol | Kind | Summary |
|---|---|---|
NexusReplay | class | Session replay. |
NexusMask | class | Redact a widget from session replay. |
NexusNavigatorObserver | class | Reports route changes to Nexus so session replay's Pages tab shows the screens a user moved through. |
NexusDioInterceptor | class | A Dio interceptor that feeds every request into session replay's Network tab — method, URL, status, duration and response size. |
NexusReplay
classSession 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).
isRecording
propertybool get isRecordingcontroller
propertyNexusReplayController get controllerThe Flutter capture engine — used by NexusScope to install the
RepaintBoundary and forward pointer events. Internal.
start()
methodFuture<void> start()Start capturing the session.
View sourcestop()
methodFuture<void> stop()Stop capturing and flush any buffered events.
View sourcepause()
methodvoid pause()Pause/resume capture (called around app background/foreground).
View sourceresume()
methodvoid resume()trackScreen()
methodvoid 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
observeRouter()
methodvoid 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
recordNetwork()
methodvoid 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
flush()
methodFuture<void> flush()dispose()
methodvoid dispose()NexusMask
classclass NexusMask extends StatefulWidgetRedact 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))NexusMask
constructorconst NexusMask({super.key, required this.child})Parameters
Prop
Type
child
fieldfinal Widget childNexusNavigatorObserver
classclass NexusNavigatorObserver extends NavigatorObserverReports 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.
didPush()
methodvoid didPush(Route<dynamic> route, Route<dynamic>? previousRoute)Parameters
Prop
Type
didReplace()
methodvoid didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute})Parameters
Prop
Type
didPop()
methodvoid didPop(Route<dynamic> route, Route<dynamic>? previousRoute)Parameters
Prop
Type
NexusDioInterceptor
classclass NexusDioInterceptor extends InterceptorA 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).
onRequest()
methodvoid onRequest(RequestOptions options, RequestInterceptorHandler handler)Parameters
Prop
Type
onResponse()
methodvoid onResponse(Response<dynamic> response, ResponseInterceptorHandler handler)Parameters
Prop
Type
onError()
methodvoid onError(DioException err, ErrorInterceptorHandler handler)Parameters
Prop
Type
