简体   繁体   English

Flutter (graphql_flutter + gql):找到这个候选,但参数不匹配

[英]Flutter (graphql_flutter + gql): Found this candidate, but the arguments don't match

When trying to build app (iOS), getting the following output:尝试构建应用程序 (iOS) 时,获得以下输出:

Removing references to graphql_flutter within the app gets rid of these errors.在应用程序中删除对graphql_flutter引用可以消除这些错误。

I've tried every single channel for Flutter and issue persists across all.我已经尝试了 Flutter 的每个频道,但问题仍然存在。

../../../flutter/.pub-cache/hosted/pub.dartlang.org/graphql-5.0.0/lib/src/core/query_manager.dart:427:23: Error: Required named parameter 'response' must be provided.
              Response(data: cachedData),
                      ^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_exec-0.3.2-alpha+1635885531651/lib/src/response.dart:23:9: Context: Found this candidate, but the arguments don't match.
  const Response({
        ^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_link-0.4.0/lib/src/response_parser.dart:10:64: Error: Required named parameter 'response' must be provided.
  Response parseResponse(Map<String, dynamic> body) => Response(
                                                               ^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_exec-0.3.2-alpha+1635885531651/lib/src/response.dart:23:9: Context: Found this candidate, but the arguments don't match.
  const Response({
        ^^^^^^^^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_http_link-0.4.0/lib/src/link.dart:128:19: Error: Required named parameter 'response' must be provided.
    yield Response(
                  ^
../../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_exec-0.3.2-alpha+1635885531651/lib/src/response.dart:23:9: Context: Found this candidate, but the arguments don't match.
  const Response({

From pubspec.yaml:来自 pubspec.yaml:

graphql_flutter: ^5.0.0
gql: ^0.13.0

From flutter doctor (Have not set up Android yet)来自flutter doctor (还没有设置Android)

[✓] Flutter (Channel stable, 2.5.3, on macOS 11.5.2 20G95 darwin-x64, locale en-US)
    • Flutter version 2.5.3 at /Users/justin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 18116933e7 (3 weeks ago), 2021-10-15 10:46:35 -0700
    • Engine revision d3ea636dc5
    • Dart version 2.14.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/justin/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 13.0, Build version 13A233
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.61.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.27.0

[✓] Connected device (2 available)
    • iPhone 13 (mobile) • BB5BF139-9146-4AC0-8316-7D044BD283B8 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 95.0.4638.69

! Doctor found issues in 1 category.

TLDR; TLDR; This issue is due to gql_exec containing a VERY RECENT breaking change in regards to the parameters which dependent libraries don't have implemented yet.此问题是由于 gql_exec 包含有关依赖库尚未实现的参数的非常新的重大更改。

To fix to this use one of the following:要解决此问题,请使用以下方法之一:

  • use code fragment below in your pubspec.lock file and don't run an upgrade until this breaking change is resolved between the libraries.在 pubspec.lock 文件中使用下面的代码片段,并且在库之间解决此破坏性更改之前不要运行升级。 (quickest solution) (最快的解决方案)
  • to use fixed versions until the dependent libraries support this functionality.使用固定版本,直到依赖库支持此功能。 (better but slower solution) (更好但更慢的解决方案)
  • gql_exec update their code to ensure this isn't a breaking change using a PATCH number (refer to: SEMVER). gql_exec 更新他们的代码以确保这不是使用 PATCH 编号的重大更改(请参阅:SEMVER)。 (best solution but could take a while) (最好的解决方案,但可能需要一段时间)

For reference from our pubspec.lock file which we are using the following versions which build参考我们的 pubspec.lock 文件,我们使用以下版本构建

gql:
    dependency: "direct main"
    description:
      name: gql
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.13.1-alpha+1633799193898"
  gql_build:
    dependency: "direct dev"
    description:
      name: gql_build
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.3.0-alpha+1633799193977"
  gql_code_builder:
    dependency: transitive
    description:
      name: gql_code_builder
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.3.0-alpha+1633799193964"
  gql_dedupe_link:
    dependency: transitive
    description:
      name: gql_dedupe_link
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.0.0"
  gql_error_link:
    dependency: transitive
    description:
      name: gql_error_link
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.0"
  gql_exec:
    dependency: transitive
    description:
      name: gql_exec
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.3.1-alpha+1633799193908"
  gql_http_link:
    dependency: transitive
    description:
      name: gql_http_link
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.4.0"
  gql_link:
    dependency: transitive
    description:
      name: gql_link
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.4.0"
  gql_transform_link:
    dependency: transitive
    description:
      name: gql_transform_link
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.2.0"
  gradient_widgets:
    dependency: "direct main"
    description:
      name: gradient_widgets
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.6.0"
  graphql:
    dependency: transitive
    description:
      name: graphql
      url: "https://pub.dartlang.org"
    source: hosted
    version: "5.0.0"
  graphql_flutter:
    dependency: "direct main"
    description:
      name: graphql_flutter
      url: "https://pub.dartlang.org"
    source: hosted
    version: "5.0.0"

If you want to dive deeper on this, refer to the file links/gql_exec/lib/src/response.dart line #27 in the following commit where the new parameter was added and declared as required.如果您想更深入地了解这一点,请参阅以下提交中的文件 links/gql_exec/lib/src/response.dart 第 27 行,其中添加并声明了新参数。 https://github.com/gql-dart/gql/commit/8699d2fcc285789ec6e891b034e98fd2b7750296#diff-99580a029d7aed82312588b8cda13419bc8f9c0e58ac97e1f7bcdad51fc39c10R27 https://github.com/gql-dart/gql/commit/8699d2fcc285789ec6e891b034e98fd2b7750296#diff-99580a029d7aed82312588b8cda13419bc8c17f9c1adc58f97fc5c5c5c5c5c5c5c5c5c5c7e

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter:找到这个候选,但 arguments 不匹配 - Flutter: Found this candidate, but the arguments don't match flutter_BottomNavigationBar_Context:找到了这个候选,但是 arguments 不匹配 - flutter_BottomNavigationBar_Context: Found this candidate, but the arguments don't match ShowDialog 上下文:找到了这个候选,但 arguments 不匹配 - ShowDialog Context: Found this candidate, but the arguments don't match 如何在 graphql_flutter 中重试对 GraphQLError 的请求 - How to retry a request on GraphQLError in graphql_flutter Websocket 重连循环,graphql_flutter - Websocket reconnection loop, graphql_flutter 使用 graphql_flutter 连接到 Graphql API 时出错 - Error when connecting to Graphql API using graphql_flutter 在操场上运行的 Graphql_flutter 突变在运行设备/模拟器上不起作用 - Graphql_flutter mutation running on playground doesn't work on running device/emulator Flutter with Firebase JWT 将 GraphQL (graphql_flutter) 请求发送到具有“格式错误的授权标头”的 Heroku Hasura - Flutter with Firebase JWT sends GraphQL (graphql_flutter) request to Heroku Hasura that has a “Malformed Authorization header” graphql_flutter 返回 LazyCacheMap,built_value deserializeWith JSON String,如何让它们协同工作 - graphql_flutter return LazyCacheMap, built_value deserializeWith JSON String, how to make them work together 如何在每次构建Query()时禁用graphql_flutter查询后端 - How to disable graphql_flutter query backend every time build Query()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM