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
other workarounds, you could also put an explicit type on the list <Future<List<A>>>[f1, f2] or on the generic method var resultsList = await Future.wait/*<List<A>>*/(futures);.
but yeah, this should work. What should happen is await creates a T | F<T> downwards context, then generic method downward inference picks the F<T> branch because the return type of Future.wait is a Future<List>. However I'm not sure if either of those steps are currently implemented. I'm fairly sure the second one is not.
edit: fix what I wrote about Future.wait's type signature
the high level issue here is https://github.com/dart-lang/sdk/issues/25490, that downwards and upwards inference aren't unified. It's possible we push down List<Future<dynamic>> as the context for Future.wait's argument type. If we do that then it probably prevents the upwards ListLiteral inference that could otherwise easily figure out the list type argument (and thus, the generic method call on the way back up).
Guess above was correct. It was downwards generic method inference dropping the Future<T> possibility from T | Future<T>. Fixed in this CL: https://codereview.chromium.org/2280463002/
This code has a warning
WARNING: Unsound implicit cast from List<dynamic> to List<List<A>> ([my_test] bin/test2.dart:6)
.but if I extract
[f1, f2]
into a local variable, it does not have this warning.The text was updated successfully, but these errors were encountered: