sujay
Sun Dec 24 2023
In Dart, metadata
provides additional information about the code. It begins with the character @
followed by either a reference to a compile-time constant or a call to a constant constructor.
There are four commonly used annotations in Dart:
@Deprecated
: This is used to indicate that a feature/method/class is deprecated and should not be used because it will be removed in future versions.
@deprecated
: This is similar to @Deprecated, with the difference being that a message can be passed with @Deprecated.
@override
: This is used to indicate that a method is intended to override a method from a superclass.
@pragma
: This is used to provide additional information to the Dart compiler.