0

build failed after flutter upgrade.

$ flutter pub run build_runner build
[INFO] Generating build script completed, took 331ms

[WARNING] ../../.pub-cache/hosted/pub.dev/floor_generator-1.4.1/lib/misc/type_utils.dart:25:26: Error: The getter 'element' isn't defined for the class 'DartType'.
 - 'DartType' is from 'package:analyzer/dart/element/type.dart' ('../../.pub-cache/hosted/pub.dev/analyzer-5.0.0/lib/dart/element/type.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'element'.
  bool get isEnumType => element is EnumElement;

how to fix it ?

form pubspec.yaml:

floor_generator: ^1.4.1

build_runner: ^2.1.2

Dmitry
  • 536
  • 1
  • 4
  • 9

2 Answers2

0

Make sure to run flutter pub get after your flutter upgrade. Then flutter pub cache repair.

High Zedd
  • 60
  • 7
0

I fixed this error by adding a line to pubspec.yaml

dependency_overrides:
  analyzer: ^5.4.0
Dmitry
  • 536
  • 1
  • 4
  • 9