hasSameFields<T extends BaseModel> method
Returns whether the given model
has the same given fields as this model.
onlyFields
and exceptFields
can be used to limit the fields that are
compared. The two are mutually exclusive and an error will be thrown if
both are specified.
Implementation
bool hasSameFields<T extends BaseModel>({
required T model,
Iterable<String>? onlyFields,
Iterable<String>? exceptFields,
}) {
return fieldsToEvaluate(onlyFields, exceptFields)
.map(
(e) => _equality(getField(e), model.getField(e)),
)
.reduce((value, element) => value && element);
}