Closed
Description
See this SO post https://stackoverflow.com/a/56300558/884522.
This is what I get on Dartpad using 2.3.1:
foo() => 0;
bar() => [foo()];
main() {
baz() => 0;
qux() => [baz()];
print(foo.runtimeType); // () => dynamic
print(bar.runtimeType); // () => dynamic
print(baz.runtimeType); // () => int
print(qux.runtimeType); // () => List<int>
}
In the post, the user gets an error when assigning a List to the top level function, but not if the local/nested function is used.
var l = [1, 2, 3];
l = bar(); // Error
l = qux(); // Works
When in Dartpad, the error occurs at the same place but is different
TypeError: Instance of 'JSArray': type 'JSArray' is not a subtype of type 'List'