setList<T> method
Sets list of values of the SchemaDocumentValue to the provided value
. If the provided T
doesnt match Kind, then false is returned.
// Create a new document
final doc = SchemaDocument();
doc.setList<String>('name', ['John', 'Doe']); // sets the field 'name' to a list of strings
Implementation
List<T>? setList<T>(List<T> v) {
if (kind != Kind.LIST) {
return null;
}
final list = <SchemaDocumentValue>[];
for (final val in v) {
final value = SchemaDocumentValue();
value.setValue<T>(val);
list.add(value);
}
listValue = ListValue(value: list);
return v;
}