Created
January 22, 2020 16:07
-
-
Save AlexVegner/585e265c2084a7b25177f00a5d58ebaf to your computer and use it in GitHub Desktop.
dart_var_final_const.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
// var | |
var variable = 1; // equivalent to int a1 = 1, type calculated from right part | |
variable = 2; // var can be mutated | |
// final | |
final imutableVariable = 'object 1'; // final is imutable | |
final imutableVariable2 = 'object 1'; // will create additional instance of string 'object 1' | |
// const | |
const constValue = 'object'; // compile time constant | |
const constValue2 = 'object'; // compiler will use 1 object for 2 const references | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment