Last active
November 9, 2021 17:57
-
-
Save tomaszpolanski/e7b0021c22a9c631e0a44c1075011093 to your computer and use it in GitHub Desktop.
Null safe
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
final String? text; | |
@override | |
Widget build(BuildContext context) { | |
final _text = text; // Assign field to local final variable | |
return Column( | |
children: [ | |
if (_text != null) Text(_text), // The `!` is not longer needed | |
], | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment