setList<T> method
Sets the provided T
value
to the SchemaDocument for the given name
of the field as a List. Returns true if the field was found and set, false otherwise.
If the field does not exist, it will be created.
final doc = SchemaDocument();
final res = doc.setList<String>('names', ['John Doe', 'Jane Doe']); // sets the value of the field 'names' to ['John Doe', 'Jane Doe']
Implementation
List<T>? setList<T>(String name, List<T> value) {
final field = fields.firstWhereOrNull((e) => e.key == name);
if (field == null) {
throw Exception('Field not found');
}
return field.setList<T>(value);
}