setList<T> method
Null safety
- List<
T> v
Sets list of values of the SchemaDocumentValue to the provided value
. If the provided T
doesnt match SchemaKind, 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 (field_2 != SchemaKind.LIST) {
return null;
}
final list = <SchemaDocumentValue>[];
for (final val in v) {
final value = SchemaDocumentValue();
value.setValue<T>(val);
list.add(value);
}
arrayValue = ArrayValue(value: list);
return v;
}