visitExtension method
Implementation
@override
StringSink visitExtension(Extension spec, [StringSink? output]) {
final out = output ??= StringBuffer();
spec.docs.forEach(out.writeln);
for (var a in spec.annotations) {
visitAnnotation(a, out);
}
out.write('extension');
if (spec.name != null) {
out.write(' ${spec.name}');
}
visitTypeParameters(spec.types.map((r) => r.type), out);
if (spec.on != null) {
out.write(' on ');
spec.on!.type.accept(this, out);
}
out.write(' {');
for (var f in spec.fields) {
visitField(f, out);
out.writeln();
}
for (var m in spec.methods) {
visitMethod(m, out);
if (_isLambdaMethod(m)) {
out.write(';');
}
out.writeln();
}
out.writeln(' }');
return out;
}