fromMap static method

ChatFolder? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static ChatFolder? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var title = _map['title']! as String;
  var icon = ChatFolderIcon.fromMap(_map['icon']);
  var is_shareable = _map['is_shareable']! as bool;
  var pinned_chat_ids = List<int>.from(
    (_map["pinned_chat_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var included_chat_ids = List<int>.from(
    (_map["included_chat_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var excluded_chat_ids = List<int>.from(
    (_map["excluded_chat_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var exclude_muted = _map['exclude_muted']! as bool;
  var exclude_read = _map['exclude_read']! as bool;
  var exclude_archived = _map['exclude_archived']! as bool;
  var include_contacts = _map['include_contacts']! as bool;
  var include_non_contacts = _map['include_non_contacts']! as bool;
  var include_bots = _map['include_bots']! as bool;
  var include_groups = _map['include_groups']! as bool;
  var include_channels = _map['include_channels']! as bool;
  return ChatFolder(
    extra: extra,
    clientId: clientId,
    title: title,
    icon: icon,
    is_shareable: is_shareable,
    pinned_chat_ids: pinned_chat_ids,
    included_chat_ids: included_chat_ids,
    excluded_chat_ids: excluded_chat_ids,
    exclude_muted: exclude_muted,
    exclude_read: exclude_read,
    exclude_archived: exclude_archived,
    include_contacts: include_contacts,
    include_non_contacts: include_non_contacts,
    include_bots: include_bots,
    include_groups: include_groups,
    include_channels: include_channels,
  );
}