Flutter extension-methods not working, it says "undefined class" and "requires the extension-methods language feature"
For the changes in pubspec.yaml and analysis_options.yaml to take place, you have to restart the Dart Analysis Server. In VSCode, that's as simple as Ctrl+Shift+P -> Reload Window.
In Android Studio solving this problem requires three steps:
Update SDK version in pubspec.yaml (must be 2.6.0 or higher)
environment: sdk: ">=2.7.0 <3.0.0"
Tools -> Flutter -> Flutter Clean
Close project and reopen it (eg. File -> Close project)
I had to do flutter clean
, then close and re-open VSCode.