Add null-check With Creating a New Variable #1526
Labels
feature
Proposed language feature that solves one or more problems
state-duplicate
This issue or pull request already exists
Dart is great, and null-safety is great too. It allows developers to eliminate null-related-crashes easily.
I strongly believe we can move forward with syntax.
Currently, developers still need to check the variable if null like that:
These checks are so similar for non-optional values, so most developers get confused and can not see the beauty of the optional types. Most of the time the someVariable variable is not being used outside of the if block.
I am suggesting null checking while defining a non-optional variable inside if block:
I inspired by other languages, of course.
Let me know what you think.
Best.
The text was updated successfully, but these errors were encountered: