dvCheckModelRules function
Refuses values that break a rule of fields with a DVModelRuleError.
What a generated model's save() asks before it writes, so a record
saved in code meets the same rules as one written through Studio or the
data API. Uniqueness is the database's to hold, through the index the
field asks for, and Studio's write checks it too.
Implementation
void dvCheckModelRules(
String model,
List<DVStudioFieldSpec> fields,
Map<String, Object?> values,
) {
for (final DVStudioFieldSpec field in fields) {
final String? problem = dvStudioValueProblem(field, values[field.name]);
if (problem != null) throw DVModelRuleError(model, field.name, problem);
}
}