5

Is it possible to show the documentation of a function in the documentation of another function residing in a different file? Macros are only valid in their own file.

In the Flutter source code, they use something like this, but it does not seem to have any effect:

/// {@macro flutter.widgets.editableText.keyboardType}
hacker1024
  • 3,186
  • 1
  • 11
  • 31
Ced
  • 15,847
  • 14
  • 87
  • 146

2 Answers2

2

Macro docs is what you are looking for. They are already explained here but in summary allows you do exactly what you want: copy a documentation from a place to somewhere else without re-write.

Alex Rintt
  • 1,618
  • 1
  • 11
  • 18
0

The best you can do is link to the referenced function.

file_a.dart

/// Also see [functionB].
void functionA() {}

file_b.dart

/// Another function.
void functionB() {}

https://dart.dev/guides/language/language-tour#documentation-comments

hacker1024
  • 3,186
  • 1
  • 11
  • 31