toMap method

Map<String, dynamic> toMap()

This is will help us to create Map Data

Implementation

Map<String, dynamic> toMap() {
  final result = <String, dynamic>{};

  if (kind != null) {
    result.addAll({'kind': kind});
  }
  if (id != null) {
    result.addAll({'id': id});
  }
  if (postId != null) {
    result.addAll({'postId': postId});
  }
  if (blogId != null) {
    result.addAll({'blogId': blogId});
  }
  if (published != null) {
    result.addAll({'published': published!.millisecondsSinceEpoch});
  }
  if (updated != null) {
    result.addAll({'updated': updated!.millisecondsSinceEpoch});
  }
  if (selfLink != null) {
    result.addAll({'selfLink': selfLink});
  }
  if (content != null) {
    result.addAll({'content': content});
  }
  if (author != null) {
    result.addAll({'author': author!.toMap()});
  }

  return result;
}