'dart show documentation from another method in another file
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}
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | hacker1024 |