Skip to main content
Lucent’s first-party Flutter SDK is published as lucent_flutter. The MVP supports iOS and Android. Flutter Web is deferred because Flutter Web needs a separate web capture path, while this SDK sends screenshot-mode mobile replay.

Requirements

  • Flutter >=3.27.0
  • Dart >=3.6.0
  • iOS 13.0 or later
  • Android min SDK 23 or later
  • A Lucent public key (luc_pk_...)

Install

lucent_flutter is not published on pub.dev yet. Until 0.1.0 is published, install it from the Lucent monorepo or from a local SDK checkout.
After the package is published to pub.dev, use the normal hosted package dependency:
Then fetch dependencies:
For iOS, use the standard Flutter CocoaPods flow:
For Android release builds, make sure your app manifest allows network access. Flutter debug and profile builds may add this automatically, but release apps should include it explicitly in android/app/src/main/AndroidManifest.xml.
CocoaPods is the verified iOS packaging path for the MVP. Swift Package Manager support is deferred because Flutter can generate a package identity from the local SDK directory that differs from the pub package name.

Quick start

Set up Lucent before runApp, then wrap your app in LucentWidget.
LucentWidget captures screenshot-mode replay, touch events, and app lifecycle events. Keep it near the root of the app so remounts do not reset the replay surface.

Screen tracking

Add LucentObserver() to your MaterialApp navigator observers to emit $screen events and update the replay URL.
If your router does not use named PageRoutes, call Lucent().screen(...) from your route listener.
You can also customize the observer for apps that need custom route names or route filtering.

Identify users

Sessions start with a generated anonymous ID. Call identify when you know the user, and call resetIdentity on sign out.

Track events

Use track for custom events. Event properties also receive metadata from LucentMetadataConfig.

Control recording

Replay starts automatically by default when the session is sampled in. You can pause, resume, flush, and inspect the current session.
Call Lucent().stop() when you need to tear down the SDK. It stops native recording, clears installed Dart hooks, and performs a final native flush. Use autoStart: false or LucentReplayConfig.eventTriggers when you need to wait for consent or only record after specific events.

Privacy masking

Flutter replay is privacy-first. Text, text inputs, and images are masked by default. Wrap extra-sensitive regions in LucentMask, and wrap safe public regions in LucentNoMask.
LucentNoMask opts the subtree into replay visibility, so only use it for UI that is safe to show in a session replay.

Logs

When capture.logs is enabled, Lucent captures Flutter debugPrint output. Wrapping runApp in Lucent().runZoned(...) also captures print(...).

Network breadcrumbs

When capture.network is enabled, Lucent().runZoned(...) installs a zone-scoped dart:io HttpClient wrapper. It captures method, sanitized URL, status, duration, and transfer size for requests made inside the zone.
For clients that do not use dart:io, call captureNetworkRequest from your HTTP wrapper or interceptor.
You can also send a manual network breadcrumb.
Lucent strips URL user info, query strings, and fragments before upload. Request bodies, response bodies, and headers are not captured.

Errors and crashes

Lucent captures Flutter framework errors and PlatformDispatcher async errors when the corresponding capture options are enabled. Use captureException for handled exceptions and addExceptionStep for lightweight breadcrumbs.
Native uncaught exceptions are stored synchronously and emitted as $native_crash on the next launch. If your app already has a top-level async error handler, pass it to runZoned.

Example app

The SDK package includes an example app that exercises setup, LucentWidget, LucentObserver, masking, custom events, manual network breadcrumbs, handled exceptions, and flush.

Next steps