【问题标题】:'StethoHttpClientResponse' is missing implementations for these members: - HttpClientResponse.compressionState in flutter_stetho'StethoHttpClientResponse' 缺少这些成员的实现:-flutter_stetho 中的 HttpClientResponse.compressionState
【发布时间】:2019-11-05 00:55:19
【问题描述】:

我在编译显示的编译器时尝试使用flutter_stetho 包..

在为 x86 构建的 Android SDK 上以调试模式启动 lib/main.dart...

编译器消息:

file:///home/administrator/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_stetho-0.2.2/lib/src/http_client_response.dart:4:7: Error: The non-abstract class 'StethoHttpClientResponse' is missing implementations for these members:
 - HttpClientResponse.compressionState

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 StethoHttpClientResponse extends StreamView<List<int>>
      ^^^^^^^^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:1967:42: Context: 'HttpClientResponse.compressionState' is defined here.
  HttpClientResponseCompressionState get compressionState;
                                         ^^^^^^^^^^^^^^^^
Compiler failed on /home/administrator/projects/mobile/sampleapp/lib/main.dart

FAILURE: Build failed with an exception.
* Where:
Script '/home/administrator/softwares/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 665

* What went wrong:
Execution failed for task ':app:compileflutterBuildDebugX86'.
> Process 'command '/home/administrator/softwares/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

【问题讨论】:

  • 如果找到包源,示例应用是否运行?
  • 我已经在我的项目中使用了这个包,我尝试在示例应用程序中也显示相同的错误显示......这发生在过去一两个月内
  • 您需要联系包作者,或者自己修复它并向他们发送拉取请求。
  • 好的,理查德·赫普

标签: flutter flutter-dependencies


【解决方案1】:

我刚刚遇到了同样的错误,我将下面的堆栈跟踪留作参考。 对我来说,这是因为我在复制粘贴方法中留下了对参数的引用。

我有这个:

Map<String, dynamic> toJson() {
    return User(
      login: json['login'],
      password: json['password'],
      firstName: json['firstName'],
      lastName: json['lastName'],
      email: json['email'],
      cellphone: json['cellphone'],
    );
  }

但正确的代码其实是:

Map<String, dynamic> toJson() {
    return {
      'login': login,
      'password': password,
      'firstName': firstName,
      'lastName': lastName,
      'email': email,
      'cellphone': cellphone,
    };
  }

在我的案例中,奇怪或偷偷摸摸的是,Visual Studio Code 在打开文件后没有指出错误。

另外,我从我基于(复制粘贴)的类中留下了构造方法,它是User

堆栈跟踪:

Compiler message:
lib/models/rest/user_post.dart:3:7: Error: The non-abstract class 'UserPost' is missing implementations for these members:
 - UserPost.User
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 UserPost {
      ^^^^^^^^
lib/models/rest/user_post.dart:33:3: Context: 'UserPost.User' is defined here.
  User({
  ^^^^
lib/models/rest/user_post.dart:15:14: Error: Getter not found: 'json'.
      login: json['login'],
             ^^^^
lib/models/rest/user_post.dart:16:17: Error: Getter not found: 'json'.
      password: json['password'],
                ^^^^
lib/models/rest/user_post.dart:17:18: Error: Getter not found: 'json'.
      firstName: json['firstName'],
                 ^^^^
lib/models/rest/user_post.dart:18:17: Error: Getter not found: 'json'.
      lastName: json['lastName'],
                ^^^^
lib/models/rest/user_post.dart:19:14: Error: Getter not found: 'json'.
      email: json['email'],
             ^^^^
lib/models/rest/user_post.dart:20:18: Error: Getter not found: 'json'.
      cellphone: json['cellphone'],
                 ^^^^

【讨论】:

    猜你喜欢
    • 2022-01-25
    • 1970-01-01
    • 2023-02-01
    • 2021-01-04
    • 1970-01-01
    • 2020-03-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    相关资源
    最近更新 更多