我的测试已经有效,但是当我将Flutter升级到新版本时,当我使用
从命令行运行它时会出现错误flutter test test/widget_test.dart
错误是
00:05 +0 -1: loading /Users/lenz/plug_and_plink/test/widget_test.dart [E]
Failed to load "/Users/lenz/project/test/widget_test.dart": type '(WidgetTester) => Future<Null>' is not a subtype of type '() => dynamic'
package:flutter_test/src/test_compat.dart 171:29 test
test/widget_test.dart 53:3 main
00:05 +0 -1: Some tests failed.
当我尝试从Android Studio UI运行测试时,它给出了另一个错误:
file:///Users/lenz/development/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
^
file:///Users/lenz/development/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
^
file:///Users/lenz/development/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
关于'dart:ui'的更多内容 怎样使它再次工作?
答案 0 :(得分:0)
我通过删除flutter目录中的/ bin / cache /文件夹解决了该问题。之后,需要运行
flutter precache
从命令行。似乎在flutter升级时这些文件没有更新