arrayTransform method

FunctionExpression arrayTransform(
  1. Object? transform(
    1. Expression element
    ), {
  2. String alias = 'element',
})

This array with every element replaced by the result of transform.

transform is called once, with an expression that stands for the current element; a result that is not an Expression is a constant.

field('prices').arrayTransform((price) => price.multiply(2));

alias is the name of the server-side variable that holds the element.

Implementation

FunctionExpression arrayTransform(
  Object? Function(Expression element) transform, {
  String alias = 'element',
}) {
  return _function('array_transform', <Object?>[
    alias,
    toExpression(transform(VariableExpression(alias))),
  ]);
}