ObbyEvent.fromJson constructor

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

Implementation

factory ObbyEvent.fromJson(Map<String, dynamic> json) {
  final tag = json['type'] as String;
  return switch (tag) {
    'capabilities_acknowledged' => ObbyEventCapabilitiesAcknowledged.fromJson(json),
    'registered' => ObbyEventRegistered.fromJson(json),
    'isupport_token' => ObbyEventIsupportToken.fromJson(json),
    'logged_in' => ObbyEventLoggedIn.fromJson(json),
    'sasl_failed' => ObbyEventSaslFailed.fromJson(json),
    'nick_in_use' => ObbyEventNickInUse.fromJson(json),
    'model_changed' => ObbyEventModelChanged.fromJson(json),
    'link_dead' => ObbyEventLinkDead.fromJson(json),
    'reconnect_after' => ObbyEventReconnectAfter.fromJson(json),
    'reconnect_abandoned' => ObbyEventReconnectAbandoned.fromJson(json),
    'command_timed_out' => ObbyEventCommandTimedOut.fromJson(json),
    'allowed_commands_changed' => ObbyEventAllowedCommandsChanged.fromJson(json),
    'bots_changed' => ObbyEventBotsChanged.fromJson(json),
    'auth_token' => ObbyEventAuthToken.fromJson(json),
    'voice' => ObbyEventVoice.fromJson(json),
    'typing_changed' => ObbyEventTypingChanged.fromJson(json),
    'presence_changed' => ObbyEventPresenceChanged.fromJson(json),
    'server_reply' => ObbyEventServerReply.fromJson(json),
    'raw_line' => ObbyEventRawLine.fromJson(json),
    _ => throw ArgumentError.value(tag, 'type', 'unknown ObbyEvent variant'),
  };
}