Home > Software engineering >  How to add code reference in comments line in android studio?
How to add code reference in comments line in android studio?

Time:05-18

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

CodePudding user response:

It is Enum of comment, it inside [ ]

You can change color of enum in Android Studio > Preferences > Editor > Colors Scheme > Dart and select Enum in list type of text editer and change color of it

And correctly enter the existing method name in [ ]

here

CodePudding user response:

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

  • Related