assignVar method Null safety

Expression assignVar(
  1. String name,
  2. [Reference? type]
)

Return var {name} = {this}.

Implementation

Expression assignVar(String name, [Reference? type]) => BinaryExpression._(
      type == null
          ? LiteralExpression._('var $name')
          : BinaryExpression._(
              type.expression,
              LiteralExpression._(name),
              '',
            ),
      this,
      '=',
    );