toMap method
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 (items != null) {
result.addAll({'items': items!.map((x) => x.toMap()).toList()});
}
if (etag != null) {
result.addAll({'etag': etag});
}
if (error != null) {
result.addAll({'error': error});
}
return result;
}