fromMap static method

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

Construct from Map.

Implementation

static OptimizeStorage? 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 size = _map['size']! as int;
  var ttl = _map['ttl']! as int;
  var count = _map['count']! as int;
  var immunity_delay = _map['immunity_delay']! as int;
  var file_types = List<FileType>.from(
    (_map["file_types"] ?? []).map(
      (e) => FileType.fromMap(e),
    ),
  );
  var chat_ids = List<int>.from(
    (_map["chat_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var exclude_chat_ids = List<int>.from(
    (_map["exclude_chat_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var return_deleted_file_statistics =
      _map['return_deleted_file_statistics']! as bool;
  var chat_limit = _map['chat_limit']! as int;
  return OptimizeStorage(
    extra: extra,
    clientId: clientId,
    size: size,
    ttl: ttl,
    count: count,
    immunity_delay: immunity_delay,
    file_types: file_types,
    chat_ids: chat_ids,
    exclude_chat_ids: exclude_chat_ids,
    return_deleted_file_statistics: return_deleted_file_statistics,
    chat_limit: chat_limit,
  );
}