update method

  1. @override
Future<void> update(
  1. String activityId,
  2. LiveActivityPayload payload
)
override

Updates a running Live Activity with the full desired state.

ActivityKit replaces content-state wholesale, so payload must contain the complete desired state, not a partial diff.

On iOS this fails for an id this app session didn't start: the handle needed to update an activity is process-local, so the update genuinely did not happen.

Implementation

@override
Future<void> update(String activityId, LiveActivityPayload payload) async {
  try {
    await methodChannel.invokeMethod<void>(
      NativeMethods.update,
      {
        NativeMethodParams.activityId: activityId,
        NativeMethodParams.payload: payload.toMap(),
      },
    );
  } on MissingPluginException {
    throw _notEnabled();
  }
}