fromJson static method

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

Implementation

static ChatFolder? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return ChatFolder(
    name: ChatFolderName.fromJson(tdMapFromJson(json['name'])),
    icon: ChatFolderIcon.fromJson(tdMapFromJson(json['icon'])),
    colorId: (json['color_id'] as int?) ?? 0,
    isShareable: (json['is_shareable'] as bool?) ?? false,
    pinnedChatIds: List<int>.from(
      tdListFromJson(
        json['pinned_chat_ids'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    includedChatIds: List<int>.from(
      tdListFromJson(
        json['included_chat_ids'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    excludedChatIds: List<int>.from(
      tdListFromJson(
        json['excluded_chat_ids'],
      ).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
    ),
    excludeMuted: (json['exclude_muted'] as bool?) ?? false,
    excludeRead: (json['exclude_read'] as bool?) ?? false,
    excludeArchived: (json['exclude_archived'] as bool?) ?? false,
    includeContacts: (json['include_contacts'] as bool?) ?? false,
    includeNonContacts: (json['include_non_contacts'] as bool?) ?? false,
    includeBots: (json['include_bots'] as bool?) ?? false,
    includeGroups: (json['include_groups'] as bool?) ?? false,
    includeChannels: (json['include_channels'] as bool?) ?? false,
  );
}