toJson method
Returns a Json i.e. Map<String, dynamic> representation of the BaseModel.
Implementation
@override
Map<String, dynamic> toJson({
dynamic defaultValue,
bool includeNulls = false,
}) {
try {
final id0 = this.id?.trim().nullIfEmpty;
final collection0 = this
.collection
?.map(
(p0) => p0?.trim().nullIfEmpty,
)
.nonNulls
.nullIfEmpty
?.toList();
final withNulls = mergeMapsDeep([
{
'id': id0,
},
{
'collection': collection0,
},
]).mapWithDefault(defaultValue);
return includeNulls ? withNulls : withNulls.nonNulls;
} catch (e) {
assert(false, 'DataRefModel.toJson: $e');
rethrow;
}
}