operator [] method
Returns an expression accessing the element at the given index
from this
array.
To pass a Dart integer for index
, wrap it in a Variable.withInt
.
Note that, by default, Postgres uses a one-based starting index!.
See also: https://www.postgresql.org/docs/current/arrays.html#ARRAYS-ACCESSING
Implementation
Expression<T> operator [](Expression<int> index) {
final inner = (driftSqlType as ArrayType<T?>).innerType;
return ArrayAccessExpression(
array: this,
index: index,
customResultType: inner as CustomSqlType<T>?,
);
}