【问题标题】:Flutter error no named parameter with the name 'scrollBehavior颤振错误没有名为“scrollBehavior”的命名参数
【发布时间】:2021-10-06 21:50:02
【问题描述】:

我在运行应用程序时收到此错误。有什么问题?我尝试更新我的豆荚。但我仍然遇到同样的错误。我有一台 M1 Mac。

    ↳
    objc[11258]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1efc22c10) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1184b82b8). One of the two will be used. Which one is undefined.
    objc[11258]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1efc22c60) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1184b8308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    Pods-Runner-elvtjvosznfleaabicgoahubaeqy
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart:297:15: Error: No named parameter with the name 'scrollBehavior'.
                  scrollBehavior: scrollBehavior,
                  ^^^^^^^^^^^^^^
    ../../../development/flutter/packages/flutter/lib/src/material/app.dart:217:9: Context: Found this candidate, but the arguments don't match.
      const MaterialApp.router({
            ^^^^^^^^^^^^^^^^^^
    ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart:340:15: Error: No named parameter with the name 'scrollBehavior'.
                  scrollBehavior: scrollBehavior,
                  ^^^^^^^^^^^^^^
    ../../../development/flutter/packages/flutter/lib/src/material/app.dart:167:9: Context: Found this candidate, but the arguments don't match.
      const MaterialApp({
            ^^^^^^^^^^^
    Command PhaseScriptExecution failed with a nonzero exit code
    Pods-Runner-elvtjvosznfleaabicgoahubaeqy
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description

【问题讨论】:

    标签: ios flutter cocoapods


    【解决方案1】:

    如果您使用的是 fvm,请检查 setting.json 中的“dart.flutterSdkPath”,确保路径正确

    // .vscode/settings.json
    
    {
      "dart.flutterSdkPath": ".fvm/flutter_sdk",
      // Remove .fvm files from search
      "search.exclude": {
        "**/.fvm": true
      },
      // Remove from file watching
      "files.watcherExclude": {
        "**/.fvm": true
      }
    }
    

    https://fvm.app/docs/getting_started/configuration

    【讨论】:

      【解决方案2】:

      如果你正在使用包 get 或任何与 get 相关的包,基本上 get 最新版本与你的项目不兼容。由于我没有直接使用它,所以我去 pubspec.lock 并将版本更改为 4.1.4 而不是最新的 4.3.4。

      【讨论】:

      • 转到 pubspec.lock 并指定“get”的版本是正确的答案。有时,即使您在 pubspec.yaml 上指定了想要的版本,pub 缓存也会继续下载不需要的版本,并且 flutter clean 不起作用
      【解决方案3】:

      只需打开 ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.4/lib/get_navigation/src/root/get_material_app.dart 文件,然后删除所有名为“scrollBehavior”的参数。 我的问题就这样解决了!

      【讨论】:

        【解决方案4】:

        您使用的是 get package latest version,但您的 flutter sdk 版本较旧。所以你需要更新你的flutter sdk。我通过将flutter sdk更新到最新版本来解决。基本上 getX 正在将 GetMaterialApp.route() 参数与 MaterialApp.route() 参数映射,但您使用的 sdk 不是最新的,因此 MaterialApp.route() 不包含 this.scrollBehavior 参数并且 getX 无法映射它。

        您可以通过两种方式解决问题:

        1st你需要安装最新的flutter sdk或者 2nd你需要降级getX包,直到它与你当前的flutter sdk兼容。

        【讨论】:

          【解决方案5】:

          您只需完全删除 scrollBehavior 功能,以便搜索该功能并通过以下方式将其删除:

          C:/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.3.8/lib/get_navigation/src/root/get_material_app.dart

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2021-04-26
            • 2021-01-05
            • 1970-01-01
            • 2021-04-26
            • 2020-01-03
            • 2021-03-24
            • 2021-12-11
            相关资源
            最近更新 更多