switchOn function
FunctionExpression
switchOn(
- BooleanExpression condition,
- Object? result, [
- List<
Object?> others = const <Object?>[]
The result that follows the first condition that holds.
others continues the list of condition/result pairs and may end with a
single default result:
switchOn(field('n').equal(1), 'one', [field('n').equal(2), 'two', 'many']);
Implementation
FunctionExpression switchOn(
BooleanExpression condition,
Object? result, [
List<Object?> others = const <Object?>[],
]) => FunctionExpression('switch_on', <Object?>[condition, result, ...others]);