Last active
October 20, 2020 15:12
-
-
Save RedBrogdon/cb03c039bd508de3435f04eb791fc5a9 to your computer and use it in GitHub Desktop.
Snippet 3: More 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
// Type parameters for generics can also be nullable or | |
// non-nullable. Try using question marks to correct the | |
// type declarations of `aNullableListOfStrings` and | |
// `aListOfNullableStrings`: | |
void main() { | |
List<String> aListofStrings = ['one', 'two', 'three']; | |
List<String> aNullableListOfStrings; | |
List<String> aListofNullableStrings = ['one', null, 'three']; | |
print('aListofStrings is $aListofStrings.'); | |
print('aNullableListOfStrings is $aNullableListOfStrings.'); | |
print('aListofNullableStrings is $aListofNullableStrings.'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment