FieldPath constructor
Creates a FieldPath from the provided field names. If more than one field name is provided, the path will point to a nested field in a document.
fieldNames a list of field names.
Return a FieldPath that points to a field location in a document. Throws an ArgumentError
if fieldNames is empty or one of the names is empty.
Implementation
factory FieldPath(List<String> fieldNames) {
checkArgument(
fieldNames.isNotEmpty,
'Invalid field path. Provided path must not be null or empty.',
);
for (int i = 0; i < fieldNames.length; ++i) {
checkArgument(
fieldNames[i].isNotEmpty,
'Invalid field name at argument ${i + 1}. Field names must not be null or empty.',
);
}
return FieldPath._(model.FieldPath.fromSegments(fieldNames));
}