createNestedRecordByIndex method

Record createNestedRecordByIndex(
  1. int index
)

Create a nested Record with the specified field index.

It throw exceptions in the following cases.

  • If you specify a field index that is not defined.
  • If the specified field is not a nested Record.

Implementation

Record createNestedRecordByIndex(int index){
  if(index < 0 || _schema == null || index >= _schema!.length){
    throw Exception("The specified field does not exist. index=$index, schema=$_schema");
  }
  return createNestedRecordByName(_schema!.fields[index].name);
}