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 (blogId != null) {
    result.addAll({'blogId': blogId});
  }
  if (published != null) {
    result.addAll({'published': published!.millisecondsSinceEpoch});
  }
  if (updated != null) {
    result.addAll({'updated': updated!.millisecondsSinceEpoch});
  }
  if (url != null) {
    result.addAll({'url': url});
  }
  if (selfLink != null) {
    result.addAll({'selfLink': selfLink});
  }
  if (title != null) {
    result.addAll({'title': title});
  }
  if (content != null) {
    result.addAll({'content': content});
  }
  if (author != null) {
    result.addAll({'author': author!.toMap()});
  }
  if (replies != null) {
    result.addAll({'replies': replies!.toMap()});
  }
  if (etag != null) {
    result.addAll({'etag': etag});
  }
  if (labels != null) {
    result.addAll({'labels': labels});
  }

  return result;
}