'How to add code reference in comments line in android studio?

I want to add code reference in comments docs like following screen shoot.

enter image description here


But this result I got

enter image description here

I really glad if someone guide me some gits or useful links for results that I want. Thanks



Solution 1:[1]

did u created the type name of showPartialLoading() and showFullScreenLoading() ?

because If you surround things like variable, method, or type names in square brackets, then dart doc will look up the name and link to its docs even from a different file in the same project doc. make sure that all identifiers exist so the comment can be referenced.

example:

///if you control + click this -> [MyApp] it will bring you to MyApp Class name

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

PS: idk why in StackOverflow code preview (markdown) doesn't show the color difference but if you run it in the dart file I'm sure it works.

Hope this will help.

more info:
https://dart.dev/guides/language/effective-dart/documentation
https://dart.dev/tools/linter-rules#comment_references
https://youtu.be/zLzlSVD85GA

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 DVCone