Search code examples
flutterdartdrift

Error on build_runner 2.4.2 run in a package with drift on Flutter 3.10.0


After updating to Flutter 3.10.0 In a package with drift I have the following error:

Failed to build build_runner:build_runner:
../../../../../.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:19:49: Error: 'CyclicInitializationError' isn't a type.
const isCyclicInitializationError = TypeMatcher<CyclicInitializationError>();
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:31:39: Error: 'NullThrownError' isn't a type.
const isNullThrownError = TypeMatcher<NullThrownError>();

I can't find anything related to it, I don't know if it's drift or not, but the dependencies are the following:

  # dependecy injection
  get_it: ^7.6.0
  injectable: ^2.1.1

  # Storage
  drift: ^2.8.0
  encrypted_drift:
    git:
      url: https://github.com/simolus3/drift.git
      path: extras/encryption

  uuid: ^3.0.7

I run flutter pub run build_runner build --delete-conflicting-outputs

and I have the following error:

Failed to build build_runner:build_runner:
../../../../../.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:19:49: Error: 'CyclicInitializationError' isn't a type.
const isCyclicInitializationError = TypeMatcher<CyclicInitializationError>();
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../../.pub-cache/hosted/pub.dev/matcher-0.12.13/lib/src/error_matchers.dart:31:39: Error: 'NullThrownError' isn't a type.
const isNullThrownError = TypeMatcher<NullThrownError>();

Solution

  • This command works for me.

    flutter pub upgrade