How to use metadata annotation to provide a warning message in Dart analyzer?

Viewed 99

I created a metadata annotation like this:

class UseInt {
  const UseInt();
}

@UseInt()
class Foo {
  // Should give a lint warning saying "The class should only use ints".
  String message = ''; 
}

As you may have seen, inbuilt Dart and Flutter metadata gives you a warning message when you try to do something against what was originally meant, something like this:

enter image description here

How can I make the IDE do something like this in my original code?

0 Answers
Related