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 (id != null) {
    result.addAll({'id': id});
  }
  if (displayName != null) {
    result.addAll({'displayName': displayName});
  }
  if (url != null) {
    result.addAll({'url': url});
  }
  if (image != null) {
    result.addAll({'image': image});
  }

  return result;
}