You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since I am copying the widget.index value to its own integer, I expect that to get captured, not the widget and thus no error about capturing and sending ui elements to an Isolate.
The text was updated successfully, but these errors were encountered:
tldr: Dart VM creates contexts from scopes, rather than creating a context pre-closure. This makes closures that share the same scope overcapture things, e.g.
voidf() {
var x, y;
foo() => x;
bar() => y;
}
// Both [foo] and [bar] capture x & y.
observed behavior
The following code executes fine:
If I change the integer literal to
index
, the app errors:error log
expected behavior
Since I am copying the
widget.index
value to its own integer, I expect that to get captured, not the widget and thus no error about capturing and sending ui elements to an Isolate.The text was updated successfully, but these errors were encountered: