Last active
August 20, 2021 09:22
-
-
Save fladago/bb9ee86d4204f63ca44397a3cb28464a to your computer and use it in GitHub Desktop.
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
//Step3 | |
late String lateName; | |
// final int finalName; // error | |
void main() { | |
//Step 1 | |
final int x; | |
const int y = 1; | |
x = 8; // ok | |
// y = 2; // error: Constant variables can't be assigned a value. | |
// x = 9; // error: The final variable 'x' can only be set once. | |
//Step2 | |
var one = const []; | |
one = const [1, 2, 3]; // ok | |
// one[0] = 4; //Unsupported operation: Cannot modify an unmodifiable list | |
final two = const []; | |
// two = const [10, 3, 23]; // error | |
const three = []; | |
// three = const [10, 3, 23]; // error | |
//Step3 | |
final int finalName; // ok | |
// print(lateName); | |
// LateInitializationError: Field 'lateName' has not been initialized | |
lateName = '#Flutter'; | |
print(lateName); // ok | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment