BonsoirBroadcastEvent.fromJson constructor

BonsoirBroadcastEvent.fromJson(
  1. Map<String, dynamic> json
)

Creates a new Bonsoir broadcast event from the given JSON map.

Implementation

BonsoirBroadcastEvent.fromJson(Map<String, dynamic> json)
    : this(
        type: BonsoirBroadcastEventType.values.firstWhere(
          (type) => type.id == json['id'],
          orElse: () => BonsoirBroadcastEventType.unknown,
        ),
        service: json.containsKey('service')
            ? BonsoirService.fromJson(
                Map<String, dynamic>.from(json['service']))
            : null,
      );