LiveActivities class

Constructors

LiveActivities.new()

Properties

activityUpdateStream Stream<ActivityUpdate>
A stream of activity updates. An event is emitted onto this stream each time a pushTokenUpdate occurs. The operating system can decide to update a push token at any time. An update can also mean that the activity has ended or it became stale
no setter
hashCode int
The hash code for this object.
no setterinherited
pushToStartTokenUpdateStream Stream<String>
A stream of push-to-start tokens for iOS 17.2+ Live Activities. This stream emits tokens that can be used to start a Live Activity remotely via push notifications.
no setter
receiveNativeMsgStream Stream<String>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allowsPushStart() Future<bool>
Checks if iOS 17.2+ which allows push start for live activities.
areActivitiesEnabled() Future<bool>
Check if iOS 16.1+ live activities are enabled.
createActivity(String activityId, Map<String, dynamic> data, {bool removeWhenAppIsKilled = false, Duration? staleIn}) Future<String?>
Create an iOS 16.1+ live activity. When the activity is created, an activity id is returned. Data is a map of key/value pairs that will be transmitted to your iOS extension widget. Files like images are limited by size, be sure to pass only small file size (you can use resizeFactor for images).
createOrUpdateActivity(String activityId, Map<String, dynamic> data, {bool removeWhenAppIsKilled = false, Duration? staleIn}) Future
dispose({bool force = false}) Future<void>
Remove all files copied in app group directory. This is recommended after you send files, files are stored but never deleted. You can set force param to remove ALL files in app group directory.
endActivity(String activityId) Future
End an iOS 16.1+ live activity. You can get an activity id by calling createActivity.
endAllActivities() Future
End all iOS 16.1+ live activities.
getActivityState(String activityId) Future<LiveActivityState?>
Get the activity state. If the activity is not found, null is returned.
getAllActivities() Future<Map<String, LiveActivityState>>
Get all iOS 16.1+ live activities and their state.
getAllActivitiesIds() Future<List<String>>
Get all iOS 16.1+ live activity ids. You can get an activity id by calling createActivity.
getPushToken(String activityId) Future<String?>
Get synchronously the push token. Prefer using the stream activityUpdateStream to keep push token up to date.
init({required String appGroupId, String? urlScheme}) Future
This is required to initialize the plugin. Create an App Group inside "Runner" target & "Extension" in Xcode. Be sure to set the SAME App Group in both targets. urlScheme is optional and is the scheme sub-component of the URL. appGroupId is the App Group identifier.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateActivity(String activityId, Map<String, dynamic> data, [AlertConfig? alertConfig]) Future
Update an iOS 16.1+ live activity. You can get an activity id by calling createActivity. Data is a map of key/value pairs that will be transmitted to your iOS extension widget. Map is limited to String keys and values for now.
urlSchemeStream() Stream<UrlSchemeData>
Get a stream of url scheme data. Don't forget to add CFBundleURLSchemes to your Info.plist file. Return a Future of scheme url host path and queryParameters.

Operators

operator ==(Object other) bool
The equality operator.
inherited