Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter build fails: Method not found 'FallThroughError'

ErrorError: Method not found: 'FallThroughError'.

Short answer

FallThroughError was removed from the Dart core libraries in Dart 3. The build now fails wherever code still names it. That is almost always an old package, such as an outdated Firebase plugin. Upgrade the dependencies. If the file is your own, finish each non-empty switch case with break, return, continue or throw.

  • Applies to Flutter 3.x stable, Dart 3
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the path in the error. A path under .pub-cache means a dependency; a path under lib/ means your own code.

    flutter pub outdated
    flutter build apk --debug 2>&1 | grep -B2 -A2 FallThroughError
  2. 2Match what you see, then jump to its fix

    1. 1The failing file is inside .pub-cache/hosted/pub.dev/<package>A dependency written for Dart 2 still throws FallThroughErrorFix
    2. 2The failing file is under lib/ and the throw sits at the end of a switch caseYour own code throws it from a switchFix

What does the error look like?

  • Error: Method not found: 'FallThroughError'.
  • throw FallThroughError();

Cause 1 of 2

A dependency written for Dart 2 still throws FallThroughError

1Check

List which packages have a newer version that your constraints keep out.

flutter pub outdated

2Fix

Upgrade the dependencies, and if that is not enough, allow major version upgrades, which also rewrites the constraints in pubspec.yaml.

flutter pub upgrade
flutter pub upgrade --major-versions

3Verify

The build passes the compile step and the error is gone.

flutter analyze
flutter build apk --debug

Confirmed by dart.dev

Did this fix it?

Cause 2 of 2

Your own code throws it from a switch

1Check

Find the throw. Dart 3 removed the class, and a non-empty case must end in a jump.

grep -rn "FallThroughError" lib/

2Fix

Delete the throw and end the case with break, continue, return or throw. Empty cases may fall into the next one to share a body.

switch (command) {
  case 'start':
    run();
    break;
  case 'a':
  case 'b':
    handleAB();
    return;
}

3Verify

The analyzer has no error and the behaviour per case is unchanged.

dart analyze

Confirmed by dart.dev

Did this fix it?

How do I stop it coming back?

  • Run flutter pub outdated before a Flutter or Dart upgrade.
  • Replace unmaintained packages that have no Dart 3 release.
  • Keep Flutter and the Firebase plugins on supported, current versions.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.