dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.08k stars 1.56k forks source link

Android Studio Dart analyzer erroneously shows 'colors' property of LinearGradient class as non-existent #43847

Closed MikeCamino closed 1 month ago

MikeCamino commented 3 years ago

Android Studio Dart analyzer erroneously shows 'colors' property of LinearGradient class as non-existent. Try to write something like LinearGradient(colors: [Color(0xFFFF4F4F), Color(0xFFB454FF)]) and you will see the following error: "The named parameter 'colors' isn't defined."

At the same time CLI dart analyze doesn't include this error

Also autosuggest shows strange list of available fields

Screenshot 2020-10-19 at 14 39 09

Version information

ajain-bst commented 3 years ago

For me, its the opposite behaviour. dartanalyze does report this incorrect error, but VScode doesnt raise it.

srawlins commented 3 years ago

I suspect something thinks this is a null safe library, and something else thinks this is not a null safe library. So the parameters of LinearGradient are being read as

srawlins commented 1 month ago

Closing as stale, since we now only support null-safe libraries; but please re-open if you can reproduce this with a recent version of Dart.