Last active
June 9, 2020 16:41
-
-
Save RedBrogdon/4ce48b97196304dda3ce56fa568c44b8 to your computer and use it in GitHub Desktop.
Snippet 2: Nullable types
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
// What if you need a variable that can hold a null | |
// value? You can declare it nullable by adding a | |
// question mark to the end of the type. In this | |
// case, try `int?`. | |
void main() { | |
int a; | |
a = null; | |
print('a is $a.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment