GlobalSearchResult.fromJson constructor

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

Implementation

GlobalSearchResult.fromJson(Map<String, dynamic> json) {
  var dialogsRaw = json['dialogs'];
  if (dialogsRaw != null && dialogsRaw.isNotEmpty) {
    dialogs = List.of(dialogsRaw)
        .map((element) => CubeDialog.fromJson(element))
        .toList();
  }

  var usersRaw = json['users'];
  if (usersRaw != null && usersRaw.isNotEmpty) {
    users = List.of(usersRaw)
        .map((element) => CubeUser.fromJson(element))
        .toList();
  }

  var messagesRaw = json['messages'];
  if (messagesRaw != null && messagesRaw.isNotEmpty) {
    messages = List.of(messagesRaw)
        .map((element) => CubeMessage.fromJson(element))
        .toList();
  }
}