ChatType.fromJson constructor

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

Implementation

factory ChatType.fromJson(Map<String, dynamic> json) {
  switch (json["@type"]) {
    case ChatTypePrivate.CONSTRUCTOR:
      return ChatTypePrivate.fromJson(json);
    case ChatTypeBasicGroup.CONSTRUCTOR:
      return ChatTypeBasicGroup.fromJson(json);
    case ChatTypeSupergroup.CONSTRUCTOR:
      return ChatTypeSupergroup.fromJson(json);
    case ChatTypeSecret.CONSTRUCTOR:
      return ChatTypeSecret.fromJson(json);
    default:
      return const ChatType();
  }
}