setByIndex method

void setByIndex(
  1. int index,
  2. Object? value
)

Set the value of the specified field index.

It throw exceptions in the following cases.

  • If you specify a field index that is not defined.
  • If you specify a field that is a view.
  • If input conversion is not possible.

Implementation

void setByIndex(int index, Object? value){
  if(index < 0 || _schema == null || index >= _schema!.length){
    throw Exception("The specified field does not exist. index=$index, schema=$_schema");
  }
  setByName(_schema!.fields[index].name, value);
}