declareConst function

Expression declareConst(
  1. String variableName, {
  2. Reference? type,
})

Declare a const variable named variableName.

Returns const {variableName}, or const {type} {variableName}.

Implementation

Expression declareConst(String variableName, {Reference? type}) =>
    BinaryExpression._(
      const LiteralExpression._('const'),
      type == null
          ? LiteralExpression._(variableName)
          : _typedVar(variableName, type),
      '',
      isConst: true,
    );