validate method Null safety
- SchemaDocument doc
Validates if all fields of the provided doc
match the SchemaDefinition fields.
Implementation
bool validate(SchemaDocument doc) {
if (doc.definition.did != did) {
return false;
}
if (doc.fields.length != fields.length) {
return false;
}
for (var i = 0; i < fields.length; i++) {
if (fields[i].name != doc.fields[i].name) {
return false;
}
if (fields[i].field_2 != doc.fields[i].field_2) {
return false;
}
}
return true;
}