Failed to build build_runner | Method not found: ‘FallThroughError’. | pub_semver

--

If you counter this error when running ‘flutter pub run build_runner watch — delete-conflicting-outputs’ after update flutter version to > 3.10 and dart to > 3.0.0

Failed to build build_runner:build_runner:
/Local/Pub/Cache/hosted/pub.dev/pub_semver-2.1.1/lib/src/version_constraint.dart:96:13: Error: Method not found: 'FallThroughError'.
throw FallThroughError();

maybe this solution will help you

  1. add or modify pubspec.yaml file (opsional)
environment:
sdk: '>=3.0.1 <4.0.0'

.
.
.

dependency_overrides:
collection:
analyzer:

2. run this command

flutter pub upgrade --major-versions

and

flutter pub get

and re-run flutter pub run build_runner watch — delete-conflicting-outputs or dart run build_runner watch -d

thanks

--

--