mergeWith method
Returns a new copy of the BaseModel with the fields updated from the
other
BaseModel. Set deepMerge
to true
to merge nested objects.
Implementation
@override
Model mergeWith(
BaseModel? other, {
bool deepMerge = false,
}) {
final a = toJson();
final b = other?.toJson() ?? {};
final data = (deepMerge ? mergeDataDeep(a, b) : {...a, ...b}) as Map;
return Model.fromJson(data.cast());
}