forInLoop function

Expression forInLoop({
  1. required Expression declaration,
  2. required Expression iterable,
  3. Code? body,
})

Implementation

Expression forInLoop({
  required Expression declaration,
  required Expression iterable,
  Code? body,
}) {
  return CodeExpression(
    Block.of([
      const Code('for ('),
      declaration.code,
      const Code(' in '),
      iterable.code,
      const Code(') {'),
      if (body case final body?) body,
      const Code('}'),
    ]),
  );
}