我创建空的颤振应用程序并添加依赖火焰。组装后我得到一个错误
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:10:8: Error: Type 'FrameTiming' not found.
List<FrameTiming> _previousTimings = [];
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:31: Error: Type 'FrameTiming' not found.
void onTimingsCallback(List<FrameTiming> timings) =>
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:44: Error: The parameter 'timings' of the method 'FPSCounter.onTimingsCallback' has type 'List<invalid-type>', which does not match the corresponding type, 'List<FrameTiming>', in the overridden method, 'Game.onTimingsCallback'.
- 'List' is from 'dart:core'.
- 'FrameTiming' is from 'dart:ui'.
Change to a supertype of 'List<FrameTiming>', or, for a covariant parameter, a subtype.
void onTimingsCallback(List<FrameTiming> timings) =>
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/game.dart:50:8: Context: This is the overridden method ('onTimingsCallback').
void onTimingsCallback(List<FrameTiming> timings) {}
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/base_game.dart:22:7: Error: Applying the mixin 'FPSCounter' to 'Game' introduces an erroneous override of 'onTimingsCallback'.
class BaseGame extends Game with FPSCounter {
^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:44: Context: The parameter 'timings' of the method 'FPSCounter.onTimingsCallback' has type 'List<invalid-type>', which does not match the corresponding type, 'List<FrameTiming>', in the overridden method, 'Game.onTimingsCallback'.
- 'List' is from 'dart:core'.
- 'FrameTiming' is from 'dart:ui'.
Change to a supertype of 'List<FrameTiming>', or, for a covariant parameter, a subtype.
void onTimingsCallback(List<FrameTiming> timings) =>
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/game.dart:50:8: Context: This is the overridden method ('onTimingsCallback').
void onTimingsCallback(List<FrameTiming> timings) {}
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:10:8: Error: 'FrameTiming' isn't a type.
List<FrameTiming> _previousTimings = [];
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:31: Error: 'FrameTiming' isn't a type.
void onTimingsCallback(List<FrameTiming> timings) =>
^^^^^^^^^^^
Compiler message:
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:10:8: Error: Type 'FrameTiming' not found.
List<FrameTiming> _previousTimings = [];
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:31: Error: Type 'FrameTiming' not found.
void onTimingsCallback(List<FrameTiming> timings) =>
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:44: Error: The parameter 'timings' of the method 'FPSCounter.onTimingsCallback' has type 'List<invalid-type>', which does not match the corresponding type, 'List<FrameTiming>', in the overridden method, 'Game.onTimingsCallback'.
- 'List' is from 'dart:core'.
- 'FrameTiming' is from 'dart:ui'.
Change to a supertype of 'List<FrameTiming>', or, for a covariant parameter, a subtype.
void onTimingsCallback(List<FrameTiming> timings) =>
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/game.dart:50:8: Context: This is the overridden method ('onTimingsCallback').
void onTimingsCallback(List<FrameTiming> timings) {}
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/base_game.dart:22:7: Error: Applying the mixin 'FPSCounter' to 'Game' introduces an erroneous override of 'onTimingsCallback'.
class BaseGame extends Game with FPSCounter {
^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:44: Context: The parameter 'timings' of the method 'FPSCounter.onTimingsCallback' has type 'List<invalid-type>', which does not match the corresponding type, 'List<FrameTiming>', in the overridden method, 'Game.onTimingsCallback'.
- 'List' is from 'dart:core'.
- 'FrameTiming' is from 'dart:ui'.
Change to a supertype of 'List<FrameTiming>', or, for a covariant parameter, a subtype.
void onTimingsCallback(List<FrameTiming> timings) =>
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/game/game.dart:50:8: Context: This is the overridden method ('onTimingsCallback').
void onTimingsCallback(List<FrameTiming> timings) {}
^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:10:8: Error: 'FrameTiming' isn't a type.
List<FrameTiming> _previousTimings = [];
^^^^^^^^^^^
../../../../.pub-cache/hosted/pub.dartlang.org/flame-0.28.0/lib/fps_counter.dart:13:31: Error: 'FrameTiming' isn't a type.
void onTimingsCallback(List<FrameTiming> timings) =>
^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
我的代码 pubspec.yaml
environment:
sdk: ">=2.3.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
flame: 0.28.0
dev_dependencies:
flutter_test:
sdk: flutter
我尝试使用火焰 0.29 错误是一样的