createNestedRecordByName method
Create a nested Record with the specified field name.
It throw exceptions in the following cases.
- If you specify a field name that is not defined.
- If the specified field is not a nested Record.
Implementation
Record createNestedRecordByName(String name){
FieldSchema? fs = _schema?.fieldMap[name];
if(fs == null){
throw Exception("The specified field does not exist. name=$name, schema=$_schema");
}
if(fs.schema == null || fs.type != Record){
throw Exception("The specified field does not record. name=$name, schema=$_schema");
}
if(_dataSet == null){
throw Exception("DataSet is null. name=$name, schema=$_schema");
}
return _dataSet!.createNestedRecord(fs.schema!);
}