In the previous blog, we briefly learned about Flutter and Dart - the programing language used in Flutter. So in this blog, we will take a look the basic concept of Dart.
Objects
Everything in Dart is an Object. Every object including null is an instance of some class and all these classes inherit from Object class.
Dynamic type
In Dart, you can either declare a dynamic variable explicitly using the dynamic keyword, or the variable can be automatically assigned to dynamic type when the data type is not explicitly declared. It can store any value. The value of a dynamic variable can change over time within the program.
Access modifier
Dart doesn't have the keywords public, protected, private. If an identifier starts with an underscore (_), it's private to its library.
Number
In Dart, all numbers are part of the Object, there are two types:
- int: representing integer values.
- double: representing fractional values.
Null Safety
Null Safety, also known as Non Nullable By Default, is the guarantee of the language that unless specified by programmer, no variable can be null. If the programmer specifically creates a nullable variable, the analyzer and compiler ensure that programmer will handle cases where the variable's value might be null.
In Dart, you can declare nullable values by adding "?" following the variable name. If you are sure that the nullable variable will not be null at runtime, you can add "!" following the variable name to indicate it.
Runes
In Dart, Runes are the UTF-32 code points of a string.
Unicode defines a unique numeric value of each letter, number, and symbol used in all of the world's writing systems. Because a Dart string is a sequence of UTF-16 code units, so representing 32-bit unicode values in a string requires special syntax. It's Runes.
Symboy
Dart symboy is a dynamic string name that used to represents an operator or identifier.
Concurrency
Dart supports concurrent programming with async-await, isolates and classes such as Future and Stream.
Thank you for reading and enjoy.
References