Live Activities
Live Activities in the Flutter SDK.
import 'package:nexus_flutter/nexus.dart';NexusLiveActivity
classLive Activities — a live, updating view of an in-progress event on the iOS Lock Screen / Dynamic Island and as an Android 16 Live Update (a promoted ongoing notification; older Android: ongoing + progress bar).
Two ways to use it:
- Server-driven (recommended): design a template in the Nexus dashboard (or send one via the API) and start/update/end it from your server. The SDK renders it on both platforms — nothing to call here.
- Local: drive it from the app with
start/update/end.
iOS needs a one-time Widget Extension that hosts NexusLiveActivityWidget
(the NexusLiveActivityKit pod) — see the README. The SDK then manages the
ActivityKit lifecycle and registers push-to-start + update tokens for you.
For a custom ActivityAttributes type, manage ActivityKit yourself and call
registerPushToStartToken / registerActivity.
| Constant | Description |
|---|---|
static const String iosActivityType = 'NexusLiveActivityAttributes' | The ActivityKit attributes type the SDK widget renders — the type server-driven starts target on iOS. |
wire()
methodvoid wire()Wire native ActivityKit callbacks → backend registration and start
observing (push-to-start tokens, push-started activities, diagnostics).
Called at init when liveActivityEnabled.
registerPushToStartToken()
methodFuture<void> registerPushToStartToken(String activityType, String token)Parameters
Prop
Type
registerActivity()
methodFuture<void> registerActivity({required String activityId, required String activityType, required String platform, String? updateToken, Map<String, dynamic>? contentState})Parameters
Prop
Type
reportEvent()
methodFuture<void> reportEvent(String activityId, String type)Report a receipt / click / failure for analytics.
Parameters
Prop
Type
start()
methodFuture<void> start(String activityId, String activityType, Map<String, dynamic> contentState, {Map<String, dynamic>? attributes, Map<String, dynamic>? template})Start a live activity locally. iOS → ActivityKit (NexusLiveActivityAttributes);
Android → a Live Update. With a template (the same JSON the dashboard
produces) contentState is the template's data: \{ step, state, progress, etaAt, values \}. Also registers the instance so the server can update it.
Parameters
Prop
Type
update()
methodFuture<void> update(String activityId, Map<String, dynamic> contentState)Parameters
Prop
Type
end()
methodFuture<void> end(String activityId, {Map<String, dynamic>? finalContentState})Parameters
Prop
Type
cacheImages()
methodFuture<void> cacheImages(List<String> urls)iOS: pre-download template image URLs into the App Group, so a server push-started activity can show them (the widget itself can't download). Activities the SDK sees start are cached automatically.
Parameters
Prop
Type
observePushToStart()
methodFuture<void> observePushToStart(String activityType)Kept for compatibility — observing now starts automatically in wire.
Parameters
Prop
Type
