-
Notifications
You must be signed in to change notification settings - Fork 170
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
cascade_invocations
false negative
#4873
Comments
I got it wrong, sorry. If the when method was called as cascade, then there would be no way of referring to But I tested something else: late final Object object;
object = Object();
object.when(
(_) => false,
orElse: (self) {
expect(self, same(object));
return false;
},
); Shouldn't this be triggering, though? Editlate final Object object;
object = Object()..when(
(_) => false,
orElse: (self) {
expect(self, same(object));
return false;
},
); This works just fine. |
late final Object object;
object = Object();
object.when(
(_) => false,
orElse: (self) {
expect(self, same(object));
return false;
},
); This one is potentially dangerous. |
Wouldn't it process the call to Is there an example that would call it first? If so, how would it know what properties |
This code would, because late final Object object;
object = Object()..banana(() {
print(object);
}); If we define extension on Object {
void banana(void Function() action) {
action();
}
} then it will throw an uninitialized late variable access error, because So if the analyzer sees an access to |
I see what you mean, thank you for the answer. Is there any documentation that I could read on that? I'd like to understand better how in my example, that call to Also, if you agree then, I believe this issue should be closed since this behaviour was intended. |
@parlough In case you know of any documentation. I'll go ahead and close this. We can re-open if it should remain open. |
Is there a specific portion of the earlier discussion you are looking for documentation of? The behavior of cascade notation, considerations for accessing As for |
TBH when I asked it, both. But since then I think I understand now what I didn't about cascade annotations, and from what you showed me on |
Describe the issue
cascade_invocations
false negative,To Reproduce
I'm not sure what is triggering on the last case (it should always trigger), maybe you can reduce the code to reproduce it, I couldn't, sorry. Here is the full example I found:
Expected behavior
All cases should trigger.
The text was updated successfully, but these errors were encountered: