Call .toList() implicitely when converting from Iterable<T> to List<T> · Issue #965 · dart-lang/language · GitHub
More Web Proxy on the site http://driver.im/
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
Frequently, I forget to type the .toList() and while the code compiles I get greated by an error on RunTime.
Similarly to how Flutter code looks cleaner since new is optional, I think it would make the code cleaner to make the call to .toList() optional as well.
The text was updated successfully, but these errors were encountered:
The language already makes it a compilation error.
But you need to disable the `implicit-cast` feature.
This is done by adding the following to the file analysis_options.yaml:
```yaml
analyzer:
strong-mode:
implicit-casts: false
```
If we were to do something around this, it would be something more general, e.g. the proposal linked in the previous comment. Given that this is already tracked, I'm going to close this out.
Note that the case that you forget to call toList will become an (opt-in) error in the upcoming null safety release, so at least you will get help from the compiler when you forget going forward.
My Flutter code is full of:
Frequently, I forget to type the
.toList()
and while the code compiles I get greated by an error on RunTime.Similarly to how Flutter code looks cleaner since new is optional, I think it would make the code cleaner to make the call to
.toList()
optional as well.The text was updated successfully, but these errors were encountered: