将 Flutter 更新为 后大师 channel ,之前编译的代码片段开始无法构建,并出现以下错误:
../pub.dartlang.org/testfairy-1.x.y/lib/src/network_logging.dart:253:7:
Error: The non-abstract class '_TestFairyClientHttpRequest' is missing implementations for these members:
- HttpClientRequest.abort
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class _TestFairyClientHttpRequest implements HttpClientRequest {
^^^^^^^^^^^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:2045:8: Context: 'HttpClientRequest.abort' is defined here.
void abort([Object? exception, StackTrace? stackTrace]);
^^^^^
最佳答案
由于新安装现在依赖于未发布的代码,Dart 和 Flutter SDK 中的一些类现在可能添加了新方法,这些方法可能正在试验新的 API。解决方案是定位每个缺失/错误的方法,并通过在 Flutter's 中定位它们的祖先来修复它们的签名。或 Dart's repo ,使用主分支。
对于问题中的特定情况,解决方案是将以下实现添加到故障类,引用自 base implementation :
@Since("2.10")
@override
void abort([Object? exception, StackTrace? stackTrace]) {
// your implementation
}
关于flutter - 错误 : The non-abstract class is missing implementations for these members: HttpClientRequest. 中止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63904697/