declareFinal function Null safety

Expression declareFinal(
  1. String variableName,
  2. {Reference? type,
  3. bool late = false}
)

Declare a final variable named variableName.

Returns final {variableName}, or final {type} {variableName}. If late is true the declaration is prefixed with late.

Implementation

Expression declareFinal(String variableName,
        {Reference? type, bool late = false}) =>
    _late(
        late,
        type == null
            ? LiteralExpression._('final $variableName')
            : BinaryExpression._(const LiteralExpression._('final'),
                _typedVar(variableName, type), ''));