Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weiguan部分container.dart报错 #6

Open
rbtice opened this issue Feb 20, 2021 · 3 comments
Open

weiguan部分container.dart报错 #6

rbtice opened this issue Feb 20, 2021 · 3 comments

Comments

@rbtice
Copy link

rbtice commented Feb 20, 2021

错误信息
Launching lib/weiguan/main.dart on Redmi K20 Pro in debug mode...
/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/dio-2.2.2/lib/src/dio_http_headers.dart:55:8: Error: The method 'DioHttpHeaders.add' has fewer named arguments than those of overridden method 'HttpH
eaders.add'.
void add(String name, value) {
^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:698:8: Context: This is the overridden method ('add').
void add(String name, Object value,
^
/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/dio-2.2.2/lib/src/dio_http_headers.dart:70:8: Error: The method 'DioHttpHeaders.set' has fewer named arguments than those of overridden method 'HttpH
eaders.set'.
void set(String name, Object value) {
^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:707:8: Context: This is the overridden method ('set').
void set(String name, Object value,
^
lib/weiguan/container.dart:68:41: Error: The argument type 'Logger Function(dynamic)' can't be assigned to the parameter type 'Logger Function()'.

  • 'Logger' is from 'package:logging/src/logger.dart' ('/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/logging-0.11.4/lib/src/logger.dart').
    _injector.registerSingleton((injector) {return Logger('app');}, dependencyName: 'app');
    ^
    lib/weiguan/container.dart:69:41: Error: The argument type 'Logger Function(dynamic)' can't be assigned to the parameter type 'Logger Function()'.
  • 'Logger' is from 'package:logging/src/logger.dart' ('/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/logging-0.11.4/lib/src/logger.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:72:41: Error: The argument type 'Logger Function(dynamic)' can't be assigned to the parameter type 'Logger Function()'.
  • 'Logger' is from 'package:logging/src/logger.dart' ('/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/logging-0.11.4/lib/src/logger.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:90:42: Error: The argument type 'WgTheme Function(dynamic)' can't be assigned to the parameter type 'WgTheme Function()'.
  • 'WgTheme' is from 'package:flutter_in_practice/weiguan/ui/theme.dart' ('lib/weiguan/ui/theme.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:100:44: Error: The argument type 'AppState Function(dynamic)' can't be assigned to the parameter type 'AppState Function()'.
  • 'AppState' is from 'package:flutter_in_practice/weiguan/ui/redux/state/app.dart' ('lib/weiguan/ui/redux/state/app.dart').
    _injector.registerDependency((injector) {
    ^
    lib/weiguan/container.dart:112:50: Error: The argument type 'Store Function(dynamic)' can't be assigned to the parameter type 'Store Function()'.
  • 'Store' is from 'package:redux/src/store.dart' ('/D:/fluttersdk/flutter/.pub-cache/hosted/pub.flutter-io.cn/redux-3.0.0/lib/src/store.dart').
  • 'AppState' is from 'package:flutter_in_practice/weiguan/ui/redux/state/app.dart' ('lib/weiguan/ui/redux/state/app.dart').
    _injector.registerSingleton<Store>((injector) {
    ^
    lib/weiguan/container.dart:122:49: Error: The argument type 'WeiguanService Function(dynamic)' can't be assigned to the parameter type 'WeiguanService Function()'.
  • 'WeiguanService' is from 'package:flutter_in_practice/weiguan/usecase/port/service/weiguan.dart' ('lib/weiguan/usecase/port/service/weiguan.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:159:47: Error: The argument type 'UserUsecases Function(dynamic)' can't be assigned to the parameter type 'UserUsecases Function()'.
  • 'UserUsecases' is from 'package:flutter_in_practice/weiguan/usecase/user.dart' ('lib/weiguan/usecase/user.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:163:47: Error: The argument type 'PostUsecases Function(dynamic)' can't be assigned to the parameter type 'PostUsecases Function()'.
  • 'PostUsecases' is from 'package:flutter_in_practice/weiguan/usecase/post.dart' ('lib/weiguan/usecase/post.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:177:48: Error: The argument type 'BasePresenter Function(dynamic)' can't be assigned to the parameter type 'BasePresenter Function()'.
  • 'BasePresenter' is from 'package:flutter_in_practice/weiguan/adapter/presenter/base.dart' ('lib/weiguan/adapter/presenter/base.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:185:48: Error: The argument type 'UserPresenter Function(dynamic)' can't be assigned to the parameter type 'UserPresenter Function()'.
  • 'UserPresenter' is from 'package:flutter_in_practice/weiguan/adapter/presenter/user.dart' ('lib/weiguan/adapter/presenter/user.dart').
    _injector.registerSingleton((injector) {
    ^
    lib/weiguan/container.dart:194:48: Error: The argument type 'PostPresenter Function(dynamic)' can't be assigned to the parameter type 'PostPresenter Function()'.
  • 'PostPresenter' is from 'package:flutter_in_practice/weiguan/adapter/presenter/post.dart' ('lib/weiguan/adapter/presenter/post.dart').
    _injector.registerSingleton((injector) {
    ^

FAILURE: Build failed with an exception.

  • Where:
    Script 'D:\fluttersdk\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'D:\fluttersdk\flutter\bin\flutter.bat'' 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 56s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 58.5s
Exception: Gradle task assembleDebug failed with exit code 1

@rbtice
Copy link
Author

rbtice commented Feb 20, 2021

我使用的是最新版fluttersdk,尝试降级后contiainer.dart不再报错,但是在运行weiguan/main.dart的时候报错
FAILURE: Build failed with an exception.

  • Where:
    Script 'D:\fluttersdk\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 362

  • What went wrong:
    A problem occurred configuring project ':shared_preferences_linux'.

Could not find method implementation() for arguments [project ':path_provider_linux'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • 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 6s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 8.0s
Gradle task assembleDebug failed with exit code 1

@rbtice
Copy link
Author

rbtice commented Feb 21, 2021

今天用网络的方法修改了shared_preferences后不在报相关错,但是运行weiguan的main.dart还是会报错。我用的flutter1.12
flutter run -t lib/weiguan/main.dart

Sending crash report to Google.
Failed to send crash report due to a network error: SocketException: OS Error: 信号灯超时时间已到
, errno = 121, address = clients2.google.com, port = 63306
Oops; flutter has exited unexpectedly.

Crash report written to D:\AAAAA\flutter-in-practice-master\flutter_05.log;
please let us know at https://github.com/flutter/flutter/issues.

flutter_05.log
flutter run -t lib/weiguan/main.dart

exception

NoSuchMethodError: NoSuchMethodError: The method 'containsKey' was called on null.
Receiver: null
Tried calling: containsKey("default_package")

#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1      Plugin._providesImplementationForPlatform (package:flutter_tools/src/plugins.dart:250:49)
#2      new Plugin._fromMultiPlatformYaml (package:flutter_tools/src/plugins.dart:113:9)
#3      new Plugin.fromYaml (package:flutter_tools/src/plugins.dart:80:21)
#4      _pluginFromPubspec (package:flutter_tools/src/plugins.dart:282:17)
#5      findPlugins.<anonymous closure> (package:flutter_tools/src/plugins.dart:305:27)
#6      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)
#7      findPlugins (package:flutter_tools/src/plugins.dart:303:12)
#8      refreshPluginsList (package:flutter_tools/src/plugins.dart:783:32)
#9      FlutterProject.ensureReadyForPlatformSpecificTooling (package:flutter_tools/src/project.dart:208:5)
#10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:601:21)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:515:33)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#13     _rootRun (dart:async/zone.dart:1126:13)
#14     _CustomZone.run (dart:async/zone.dart:1023:19)
#15     _runZoned (dart:async/zone.dart:1518:10)
#16     runZoned (dart:async/zone.dart:1465:12)
#17     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#18     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:505:20)
#19     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
#20     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:413:21)
<asynchronous suspension>
#21     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#22     _rootRun (dart:async/zone.dart:1126:13)
#23     _CustomZone.run (dart:async/zone.dart:1023:19)
#24     _runZoned (dart:async/zone.dart:1518:10)
#25     runZoned (dart:async/zone.dart:1465:12)
#26     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#27     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:19)
#28     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#29     new Future.sync (dart:async/future.dart:224:31)
#30     CommandRunner.run (package:args/command_runner.dart:112:14)
#31     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:250:18)
#32     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:63:22)
#33     _rootRun (dart:async/zone.dart:1126:13)
#34     _CustomZone.run (dart:async/zone.dart:1023:19)
#35     _runZoned (dart:async/zone.dart:1518:10)
#36     runZoned (dart:async/zone.dart:1502:12)
#37     run.<anonymous closure> (package:flutter_tools/runner.dart:61:18)
<asynchronous suspension>
#38     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:146:29)
#39     _rootRun (dart:async/zone.dart:1126:13)
#40     _CustomZone.run (dart:async/zone.dart:1023:19)
#41     _runZoned (dart:async/zone.dart:1518:10)
#42     runZoned (dart:async/zone.dart:1465:12)
#43     AppContext.run (package:flutter_tools/src/base/context.dart:145:18)
#44     runInContext (package:flutter_tools/src/context_runner.dart:64:24)
#45     run (package:flutter_tools/runner.dart:50:10)
#46     main (package:flutter_tools/executable.dart:65:9)
#47     main (file:///D:/fluttersdk/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#48     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#49     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

@jaggerwang
Copy link
Owner

目前项目所用的 Flutter 版本已经比较老了,最近比较忙,暂时没有时间来升级到新版本。欢迎提交 Pull Request 来升级到最新的 Flutter 2,注意相关的第三方库估计也要升级。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants