Dart Symbols
Symbols data type in Dart
A symbol is an object that is the representation of an operator or identifier in Dart. These are compile-time constants.
They are used in APIs that refer to identifiers by name.
Example,
#radix
Dart symbols are the dynamic strings that are used to derive metadata from a library. Metadata is the data about data. The symbol uses a technique called Reflection to derive the metadata at runtime.
Conversion of Symbol to String
Dart symbols can be converted to their equivalent string using the built – in class MirrorClass provided by the 'dart:mirror' package.
Program
import 'dart: mirrors';
void main( )
{
Symbol lib = new Symbol( "<sym_lib>" ) ;
String name_of_lib = MirrorSystem.getName( lib ) ;
print( lib ) ;
print( name_of_lib ) ;
}
Output: