I don't know if this was happening before my switch to the beta channel in Flutter but I don't understand why this is an error. A List is an Iterable right? I took the example from the official docs.
Iterable<int> example() {
Iterable<int> iterable = [1, 2, 3];
return iterable;
}
VSCode marks the list with a red underline telling me:
A value of type 'List<int>' can't be assigned to a variable of type 'Iterable<int>'.
Try changing the type of the variable, or casting the right-hand type to 'Iterable<int>'. dart(invalid_assignment)
You need convert again the results to List adding .toList() in the end because Dart changes the type of the variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With