mergeWith method

FieldModel mergeWith(
  1. BaseModel? other, {
  2. bool deepMerge = false,
})

Creates a copy of this instance, merging another model's fields into this model's fields.

Implementation

FieldModel mergeWith(
  BaseModel? other, {
  bool deepMerge = false,
}) {
  final a = toJson();
  final b = other?.toJson() ?? {};
  final data = (deepMerge ? mergeDataDeep(a, b) : {...a, ...b}) as Map;
  return FieldModel.fromJson(data.cast());
}