startConstCode method

void startConstCode(
  1. bool isConst,
  2. Null visit()
)
inherited

Executes visit within a context which may alter the output if isConst is true.

This allows constant expressions to omit the const keyword if they are already within a constant expression.

Implementation

void startConstCode(
  bool isConst,
  Null Function() visit,
) {
  final previousConstContext = _withInConstExpression;
  if (isConst) {
    _withInConstExpression = true;
  }

  visit();
  _withInConstExpression = previousConstContext;
}