start method
Starts a Live Activity and returns its activity id.
payload selects the template: a built-in one, or your own type named by
LiveActivitiesConfig.customType via LiveActivityPayload.custom.
Implementation
@override
Future<String> start(LiveActivityPayload payload) async {
try {
final result = await methodChannel.invokeMethod<String>(
NativeMethods.start,
{NativeMethodParams.payload: payload.toMap()},
);
// A null id means the platform reported success without starting anything. Returning '' would
// hand back an id that looks usable and only fails later, on an update or end that silently
// matches nothing — fail here instead, where the cause is still visible.
return result ?? (throw _noActivityId(NativeMethods.start));
} on MissingPluginException {
throw _notEnabled();
}
}