VariableDefinition constructor

VariableDefinition(
  1. String name, {
  2. List<DocComment> docComments = const [],
  3. List<Annotation> annotations = const [],
  4. bool static = false,
  5. Modifier modifier = Modifier.var$,
  6. Type? type,
  7. Expression? value,
})

Implementation

VariableDefinition(this.name,
    {this.docComments = const [],
    this.annotations = const [],
    this.static = false,
    this.modifier = Modifier.var$,
    this.type,
    this.value})
    : super([
        ...docComments,
        ...annotations,
        if (static) KeyWord.static$,
        if (static) Space(),
        if (modifier == Modifier.lateVar$ || modifier == Modifier.lateFinal$)
          KeyWord.late$,
        if (modifier == Modifier.lateVar$ || modifier == Modifier.lateFinal$)
          Space(),
        if ((modifier == Modifier.var$ || modifier == Modifier.lateVar$) &&
            type == null)
          KeyWord.var$,
        if ((modifier == Modifier.var$ || modifier == Modifier.lateVar$) &&
            type == null)
          Space(),
        if (modifier == Modifier.final$ || modifier == Modifier.lateFinal$)
          KeyWord.final$,
        if (modifier == Modifier.final$ || modifier == Modifier.lateFinal$)
          Space(),
        if (modifier == Modifier.const$) KeyWord.const$,
        if (modifier == Modifier.const$) Space(),
        if (type != null) type,
        if (type != null) Space(),
        IdentifierStartingWithLowerCase(name),
        if (value != null) Space(),
        if (value != null) Code('='),
        if (value != null) Space(),
        if (value != null) value,
      ]);