visitMixin method Null safety

  1. @override
StringSink visitMixin(
  1. Mixin spec,
  2. [StringSink? output]
)

Implementation

@override
StringSink visitMixin(Mixin spec, [StringSink? output]) {
  final out = output ??= StringBuffer();
  spec.docs.forEach(out.writeln);
  spec.annotations.forEach((a) => visitAnnotation(a, out));

  out.write('mixin ${spec.name}');
  visitTypeParameters(spec.types.map((r) => r.type), out);
  if (spec.on != null) {
    out.write(' on ');
    spec.on!.type.accept(this, out);
  }
  if (spec.implements.isNotEmpty) {
    out
      ..write(' implements ')
      ..writeAll(
          spec.implements.map<StringSink>((m) => m.type.accept(this)), ',');
  }
  out.write('  {');
  spec.fields.forEach((f) {
    visitField(f, out);
    out.writeln();
  });
  spec.methods.forEach((m) {
    visitMethod(m, out);
    if (_isLambdaMethod(m)) {
      out.write(';');
    }
    out.writeln();
  });
  out.write('  }');
  return out;
}