ActivityUpdate.fromMap constructor
ActivityUpdate.fromMap(
- Map<String, dynamic> map
)
Implementation
factory ActivityUpdate.fromMap(Map<String, dynamic> map) {
final status = LiveActivityState.values.byName(map['status']);
final activityId = map['activityId'] as String;
switch (status) {
case LiveActivityState.active:
return ActiveActivityUpdate(
activityId: activityId, activityToken: map['token'] as String);
case LiveActivityState.ended:
case LiveActivityState.dismissed:
return EndedActivityUpdate(activityId: activityId);
case LiveActivityState.stale:
return StaleActivityUpdate(activityId: activityId);
case LiveActivityState.unknown:
return UnknownActivityUpdate(activityId: activityId);
}
}