RealtimeServerFrame.fromJson constructor

RealtimeServerFrame.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory RealtimeServerFrame.fromJson(Map<String, Object?> json) =>
    switch (json['type'] as String) {
      'helloAck' => RealtimeHelloAck.fromJson(json),
      'subscriptionAck' => RealtimeSubscriptionAck.fromJson(json),
      'unsubscribeAck' => RealtimeUnsubscribeAck.fromJson(json),
      'resumeAck' => RealtimeResumeAck.fromJson(json),
      'refreshAccessTokenAck' => RealtimeRefreshAccessTokenAck.fromJson(json),
      'event' => RealtimeEvent.fromJson(json),
      'poke' => RealtimePoke.fromJson(json),
      'invalidate' => RealtimeInvalidation.fromJson(json),
      'heartbeat' => RealtimeHeartbeat.fromJson(json),
      'error' => RealtimeError.fromJson(json),
      'pong' => RealtimePong.fromJson(json),
      final other => throw FormatException(
        'Unknown RealtimeServerFrame.type: $other',
      ),
    };