I see many instances of @
sign like @package_name or @somthing in dart. Although I know the usage of some examples like @override
, I can't understand why some packages(eg: @freezed
) or dart syntax(eg: @immutable
,@lazySingleton
) use this operator and what its functionality is.
As Kherel mentioned, the @ symbol is for metadata. It helps developers keep track of certain functions for future purposes.
If you want, you can then use that metadata for programmatic purposes using the 'dart:mirrors' library.
For example, flutter uses @override to ensure that child classes are allowed their specific behavior, separate from the parents.
The most common usage is to classify functions and classes in some way for easy access. IDEs may also keep track of certain metadata to warn you about the way functions operate (via @TODO or @deprecated, for instance).