arrayTransformWithIndex method
FunctionExpression
arrayTransformWithIndex(
- Object? transform(
- Expression element,
- Expression index
- String elementAlias = 'element',
- String indexAlias = 'index',
Like arrayTransform, but transform also receives an expression for
the position of the element in the array.
Implementation
FunctionExpression arrayTransformWithIndex(
Object? Function(Expression element, Expression index) transform, {
String elementAlias = 'element',
String indexAlias = 'index',
}) {
return _function('array_transform', <Object?>[
elementAlias,
indexAlias,
toExpression(
transform(
VariableExpression(elementAlias),
VariableExpression(indexAlias),
),
),
]);
}