fromMap static method

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

Construct from Map.

Implementation

static Story? 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 id = _map['id']! as int;
  var sender_chat_id = _map['sender_chat_id']! as int;
  var date = _map['date']! as int;
  var is_being_sent = _map['is_being_sent']! as bool;
  var is_being_edited = _map['is_being_edited']! as bool;
  var is_edited = _map['is_edited']! as bool;
  var is_pinned = _map['is_pinned']! as bool;
  var is_visible_only_for_self = _map['is_visible_only_for_self']! as bool;
  var can_be_deleted = _map['can_be_deleted']! as bool;
  var can_be_edited = _map['can_be_edited']! as bool;
  var can_be_forwarded = _map['can_be_forwarded']! as bool;
  var can_be_replied = _map['can_be_replied']! as bool;
  var can_toggle_is_pinned = _map['can_toggle_is_pinned']! as bool;
  var can_get_viewers = _map['can_get_viewers']! as bool;
  var has_expired_viewers = _map['has_expired_viewers']! as bool;
  var interaction_info =
      StoryInteractionInfo.fromMap(_map['interaction_info']);
  var chosen_reaction_type =
      ReactionType.fromMap(_map['chosen_reaction_type']);
  var privacy_settings =
      StoryPrivacySettings.fromMap(_map['privacy_settings'])!;
  var content = StoryContent.fromMap(_map['content'])!;
  var areas = List<StoryArea>.from(
    (_map["areas"] ?? []).map(
      (e) => StoryArea.fromMap(e),
    ),
  );
  var caption = FormattedText.fromMap(_map['caption'])!;
  return Story(
    extra: extra,
    clientId: clientId,
    id: id,
    sender_chat_id: sender_chat_id,
    date: date,
    is_being_sent: is_being_sent,
    is_being_edited: is_being_edited,
    is_edited: is_edited,
    is_pinned: is_pinned,
    is_visible_only_for_self: is_visible_only_for_self,
    can_be_deleted: can_be_deleted,
    can_be_edited: can_be_edited,
    can_be_forwarded: can_be_forwarded,
    can_be_replied: can_be_replied,
    can_toggle_is_pinned: can_toggle_is_pinned,
    can_get_viewers: can_get_viewers,
    has_expired_viewers: has_expired_viewers,
    interaction_info: interaction_info,
    chosen_reaction_type: chosen_reaction_type,
    privacy_settings: privacy_settings,
    content: content,
    areas: areas,
    caption: caption,
  );
}