fromMap static method

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

Construct from Map.

Implementation

static PageBlockEmbeddedPost? 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 url = _map['url']! as String;
  var author = _map['author']! as String;
  var author_photo = Photo.fromMap(_map['author_photo']);
  var date = _map['date']! as int;
  var page_blocks = List<PageBlock>.from(
    (_map["page_blocks"] ?? []).map(
      (e) => PageBlock.fromMap(e),
    ),
  );
  var caption = PageBlockCaption.fromMap(_map['caption'])!;
  return PageBlockEmbeddedPost(
    extra: extra,
    clientId: clientId,
    url: url,
    author: author,
    author_photo: author_photo,
    date: date,
    page_blocks: page_blocks,
    caption: caption,
  );
}