ConnectionState.fromJson constructor

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

a ConnectionState return type can be :

  • ConnectionStateWaitingForNetwork
  • ConnectionStateConnectingToProxy
  • ConnectionStateConnecting
  • ConnectionStateUpdating
  • ConnectionStateReady

Implementation

factory ConnectionState.fromJson(Map<String, dynamic> json) {
  switch (json["@type"]) {
    case ConnectionStateWaitingForNetwork.CONSTRUCTOR:
      return ConnectionStateWaitingForNetwork.fromJson(json);
    case ConnectionStateConnectingToProxy.CONSTRUCTOR:
      return ConnectionStateConnectingToProxy.fromJson(json);
    case ConnectionStateConnecting.CONSTRUCTOR:
      return ConnectionStateConnecting.fromJson(json);
    case ConnectionStateUpdating.CONSTRUCTOR:
      return ConnectionStateUpdating.fromJson(json);
    case ConnectionStateReady.CONSTRUCTOR:
      return ConnectionStateReady.fromJson(json);
    default:
      return null;
  }
}