PostComments.fromMap constructor

PostComments.fromMap(
  1. Map<String, dynamic> map
)

This is will help us to create object from Map

Implementation

factory PostComments.fromMap(Map<String, dynamic> map) {
  return PostComments(
    kind: map['kind'],
    id: map['id'],
    postId: map['post']['id'],
    blogId: map['blog']['id'],
    published: map['published'] != null
        ? DateTime.parse(map[
            'published']) //DateTime.fromMillisecondsSinceEpoch(map['published'])
        : null,
    updated: map['updated'] != null
        ? DateTime.parse(map[
            'updated']) //DateTime.fromMillisecondsSinceEpoch(map['updated'])
        : null,
    selfLink: map['selfLink'],
    content: map['content'],
    author: map['author'] != null ? Author.fromMap(map['author']) : null,
  );
}