2

I am tried to use flutter_stetho package when it Compile the compiler shown ..

Launching lib/main.dart on Android SDK built for x86 in debug mode...

Compiler message:

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)
Mirror
  • 89
  • 1
  • 3

1 Answers1

0

I have just faced the same error, I'm leaving the stack trace below for reference. For me it was caused because I left a reference to a parameter in a copy-pasted method.

I had this:

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

But the correct code is actually:

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

What was odd or sneaky in my case was that Visual Studio Code was not pointing out the error after opening the file.

Also, I left the constructor method from the class I based on (copy pasted) which was User

Stack trace:

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'],
                 ^^^^
Traufvihal
  • 54
  • 6