Ternary operator type checking #35283
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
type-enhancement
A request for a change that isn't a bug
Thank you for taking the time to file an issue!
In order to route, prioritize, and act on this, please include:
So i accidentally wrote this code
int point = snapshot.hasData ? snapshot.data < 0 ? "-" : snapshot.data : "-";
and somehow i able to insert a string value to the int variable and it produced no error whatsoever. But, when it ran on the users phone it produce error
_TypeError
type '_OneByteString' is not a subtype of type 'int'
I think somehow dart think that this expression will not produced an error so it compiles successfully.
But in fact it will produced an error because i inserted a string value to an int.
Or maybe the problem lies on Android studio that i used?
The text was updated successfully, but these errors were encountered: