json_model icon indicating copy to clipboard operation
json_model copied to clipboard

问题:Logger.onLevelChanged

Open JieHaoCai opened this issue 2 years ago • 4 comments

Failed to build json_model:json_model: ../../AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/build_runner_core-7.2.2/lib/src/logging/build_for_input_logger.dart:13:7: Error: The non-abstract class 'BuildForInputLogger' is missing implementations for th ese members:

  • Logger.onLevelChanged 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 BuildForInputLogger implements Logger { ^^^^^^^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/logging-1.2.0/lib/src/logger.dart:162:22: Context: 'Logger.onLevelChanged' is defined here. Stream<Level?> get onLevelChanged { ^^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.flutter-io.cn/build_runner-2.1.11/lib/src/build_script_generate/bootstrap.dart:76:40: Error: Method not found: 'NullThrownError'. final error = e[0] as Object? ?? NullThrownError();

JieHaoCai avatar Oct 20 '23 09:10 JieHaoCai

dev_dependencies: flutter_lints: ^2.0.0 json_model: ^1.0.0 json_serializable: ^5.0.0

JieHaoCai avatar Oct 20 '23 09:10 JieHaoCai

dev_dependencies: flutter_lints: ^2.0.0 json_model: ^1.0.0 json_serializable: ^5.0.0

I resolved the same error by following the below link: https://github.com/dart-lang/build/issues/3519#issuecomment-1722803465

pingia avatar Oct 28 '23 14:10 pingia

Terminal Command: 1.dart pub upgrade 2.dart pub outdated 3.dart pub upgrade --major-versions 4.flutter packages pub run json_model or (dart run json_mode)

Zhoulive avatar Sep 08 '24 06:09 Zhoulive

because the version of logging in your project is incompatible with the version used by json_model, you should specify the logging version.

just do it follow this:

  1. delete pubspec.lock

  2. add dependencies logging: ^1.0.1

  3. flutter pub get

sayLX avatar Sep 27 '24 04:09 sayLX