-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"if not null" operators #131
Comments
It is a common pattern to "do something if something is not null". The The |
Good point, |
Something like that: border: borderColor ?? Border.all(color: borderColor, width: 1), border is optional, so I have to do: border: borderColor != null border: borderColor !? Border.all(color: borderColor, width: 1), |
Probably not very compatible with Dart explicit bool rules, but another option would be to allow an exception with null and use the |
Dart supports "if null" access and assignment operators —
??
,??=
.Equivalent "if not null" operators would also be useful, particularly when non-nullable types land (#110). They would allow concise use of nullable variables in a similar manner to quiver's
Optional
. E.g., instead of:nullable variables could be used:
The text was updated successfully, but these errors were encountered: