Skip to content

Smart cast not smart enough. #3126

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

Closed
techwn opened this issue Jun 2, 2023 · 2 comments
Closed

Smart cast not smart enough. #3126

techwn opened this issue Jun 2, 2023 · 2 comments
Labels
request Requests to resolve a particular developer problem state-duplicate This issue or pull request already exists

Comments

@techwn
Copy link

techwn commented Jun 2, 2023

When I judge variable not null, Dart allow me use variable as non-nullable:
image

But when I wrote like this, Dart not understand that variable is non-nullable now:
image

@techwn techwn added the request Requests to resolve a particular developer problem label Jun 2, 2023
@srawlins
Copy link
Member

srawlins commented Jun 5, 2023

Duplicate of #1224

@srawlins srawlins marked this as a duplicate of #1224 Jun 5, 2023
@lrhn
Copy link
Member

lrhn commented Jun 6, 2023

Agree. Closing as duplicate.
There are many ways to infer that a variable is not null, we currently only promote on direct == null/!= null checks and is NonNullabelType. The #1224 issue can stand in for all the ways we can do more.

@lrhn lrhn closed this as completed Jun 6, 2023
@lrhn lrhn added the state-duplicate This issue or pull request already exists label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request Requests to resolve a particular developer problem state-duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants