Dart SDK version mismatch while installing build_runner

I encountered this problem after doing some cleaning up of my directories and having downloaded/installed the latest flutter. Bam. Then I realised that version of flutter sits by default on channel stable. After switching to master, it solved my problem, i.e.:

flutter channel master
flutter upgrade

This is an issue with the latest releases of dart, analyzer, and flutter creating conflicts with each other, which you can read more about at this Github issue. There likely is no real issue with your configuration.

A temporary solution that I've seen is to use a dependency override of the analyzer:

dev_dependencies:
  build_runner: ^1.10.0

dependency_overrides:
  analyzer: 0.39.14

As of September 28, 2020 the latest version of Flutter on stable channel no longer has this issue.

Use these commands to upgrade.

flutter channel stable
flutter upgrade