Flutter构建失败:NoSuchMethodError:在null上调用了getter'futureDynamicType'

时间:2019-10-21 08:45:37

标签: flutter

我刚刚进入了一个基于flutter的现有项目,而在尝试构建它时,却遇到了这个错误。

另一个同事没有问题。

在运行运行器脚本期间,它因以下错误而失败:

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


NoSuchMethodError: The getter 'futureDynamicType' was called on null.
Receiver: null
Tried calling: futureDynamicType
dart:core                                                       Object.noSuchMethod
package:analyzer/src/dart/element/element.dart 7053:40          LibraryElementImpl.createLoadLibraryFunctionForLibrary
package:analyzer/src/dart/element/element.dart 6903:9           LibraryElementImpl.createLoadLibraryFunction
package:analyzer/src/summary/resynthesize.dart 363:24           SummaryResynthesizer.getLibraryElement.<fn>
dart:collection                                                 _LinkedHashMapMixin.putIfAbsent
package:analyzer/src/summary/resynthesize.dart 351:36           SummaryResynthesizer.getLibraryElement
package:analyzer/src/summary/resynthesize.dart 414:20           SummaryResynthesizer._buildTypeProvider
package:analyzer/src/summary/resynthesize.dart 202:5            new SummaryResynthesizer
package:analyzer/src/summary/package_bundle_reader.dart 154:9   new StoreBasedSummaryResynthesizer
package:analyzer/src/dart/analysis/library_context.dart 100:27  new LibraryContext
package:analyzer/src/dart/analysis/driver.dart 1626:29          AnalysisDriver._createLibraryContext
package:analyzer/src/dart/analysis/driver.dart 1570:26          AnalysisDriver._computeUnitElement
package:analyzer/src/dart/analysis/driver.dart 1170:34          AnalysisDriver.performWork
package:analyzer/src/dart/analysis/driver.dart 2188:24          AnalysisDriverScheduler._run
package:analyzer/src/dart/analysis/driver.dart 2118:5           AnalysisDriverScheduler.start
package:build_resolvers/src/analysis_driver.dart 54:13          analysisDriver
package:build_resolvers/src/resolver.dart 138:18                new AnalyzerResolvers
package:build_runner_core/src/generate/options.dart 132:19      BuildOptions.create
package:build_runner/src/generate/build.dart 84:36              build
package:build_runner/src/entrypoint/build.dart 28:24            BuildCommand.run
package:args/command_runner.dart 197:27                         CommandRunner.runCommand
package:args/command_runner.dart 112:25                         CommandRunner.run.<fn>
dart:async                                                      new Future.sync
package:args/command_runner.dart 112:14                         CommandRunner.run
package:build_runner/src/entrypoint/run.dart 24:31              run
.dart_tool/build/entrypoint/build.dart 22:22                    main

pub finished with exit code 1

任何想法会导致什么?我没有碰这个项目。

2 个答案:

答案 0 :(得分:1)

我不得不将Flutter的等级从1.10降级到1.9。

答案 1 :(得分:1)

此问题已在此处https://github.com/dart-lang/build/issues/2482

解决。

只需运行

flutter pub upgrade