【Flutter】错误:没有名为’kind’的命名参数

huangapple go评论90阅读模式
英文:

【Flutter】Error: No named parameter with the name 'kind'

问题

这是一个Flutter项目。
我尝试了以下步骤:

  1. $Flutter clean
  2. $Flutter pub cache repair
  3. photo_view: ^0.14.0
  4. 使用拉取请求中的document_scanner_flutter版本

然而,这些都没有任何效果。

  • 错误消息
错误(Xcode):
../../.pub-cache/hosted/pub.dev/photo_view-0.12.0/lib/src/core/photo_view_gesture_detector.dart:89:
38: 错误:没有名为 'kind' 的命名参数。

无法为模拟器构建应用程序。
在iPhone 14上启动应用程序时出错。
  • pubspec.yaml
name: xxxx
environment:
  sdk: ">=2.19.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_staggered_grid_view: ^0.6.2
  font_awesome_flutter: ^10.4.0
  jiffy: ^6.1.0
  carousel_slider: ^4.2.1
  image_picker: ^0.8.7+1
  path_provider: ^2.0.14
  document_scanner_flutter: ^0.2.7
  permission_handler: ^10.2.0
  ffmpeg_kit_flutter_full_gpl: 5.1.0-LTS
  fluttertoast: ^8.2.1
  provider: ^6.0.5
  media_scanner: ^2.1.0
  share_plus: ^4.5.3
  sqflite: ^2.2.6
  google_mobile_ads: ^2.4.0
  flutter_launcher_icons: ^0.13.0
  package_info_plus: ^3.1.0
  image_gallery_saver: ^1.7.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true
  • Flutter doctor -v
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.4 22F66 darwin-arm64, locale ja-JP)
    • Flutter版本3.10.2,通道stable,位于/Users/t/Developer/flutter
    • 上游存储库https://github.com/flutter/flutter.git
    • 框架修订9cd3d0d9ff(4周前),2023-05-23 20:57:28 -0700
    • 引擎修订90fa3ae28f
    • Dart版本3.0.2
    • DevTools版本2.23.1

[✓] Android工具链 - 用于Android设备的开发(Android SDK版本31.0.0)
    • Android SDK位于/Users/t/Library/Android/sdk
    • 平台android-33,构建工具31.0.0
    • Java二进制文件位于:/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java版本OpenJDK Runtime Environment(构建11.0.12+0-b1504.28-7817840)
    • 已接受所有Android许可证。

[✓] Xcode - 用于iOS和macOS的开发(Xcode 14.3.1)
    • Xcode位于/Applications/Xcode.app/Contents/Developer
    • 构建14E300c
    • CocoaPods版本1.11.3
英文:

This is a Flutter project.
I have tried the following

  1. $Flutter clean
  2. $Flutter pub cache repair
  3. photo_view: ^0.14.0
  4. use the version of document_scanner_flutter in the pull request

However, none of these had any effect.

  • Error message
Error (Xcode):
../../.pub-cache/hosted/pub.dev/photo_view-0.12.0/lib/src/core/photo_view_gesture_detector.dart:89:
38: Error: No named parameter with the name &#39;kind&#39;.


Could not build the application for the simulator.
Error launching application on iPhone 14.
  • pubspec.yaml
name: xxxx
environment:
  sdk: &quot;&gt;=2.19.2 &lt;3.0.0&quot;

dependencies:
  flutter:
    sdk: flutter

  flutter_staggered_grid_view: ^0.6.2
  font_awesome_flutter: ^10.4.0
  jiffy: ^6.1.0
  carousel_slider: ^4.2.1
  image_picker: ^0.8.7+1
  path_provider: ^2.0.14
  document_scanner_flutter: ^0.2.7
  permission_handler: ^10.2.0
  ffmpeg_kit_flutter_full_gpl: 5.1.0-LTS
  fluttertoast: ^8.2.1
  provider: ^6.0.5
  media_scanner: ^2.1.0
  share_plus: ^4.5.3
  sqflite: ^2.2.6
  google_mobile_ads: ^2.4.0
  flutter_launcher_icons: ^0.13.0
  package_info_plus: ^3.1.0
  image_gallery_saver: ^1.7.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true
  • Flutter doctor -v
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.4 22F66 darwin-arm64, locale ja-JP)
    • Flutter version 3.10.2 on channel stable at /Users/t/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 9cd3d0d9ff (4 weeks ago), 2023-05-23 20:57:28 -0700
    • Engine revision 90fa3ae28f
    • Dart version 3.0.2
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/t/Library/Android/sdk
    • Platform android-33, build-tools 31.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

答案1

得分: 2

我遇到了相同的问题。不太清楚原因,但我通过转到文件photo_view_gesture_detector.dart并从父构造函数中移除kind字段来修复了此问题。将super(debugOwner: debugOwner, kind: kind)更改为super(debugOwner: debugOwner)

英文:

I have the same issue. Don't really know the reason, but, I was able to fix this by going to the file photo_view_gesture_detector.dart and removing kind field from super constructor. Change super(debugOwner: debugOwner, kind: kind) to super(debugOwner: debugOwner)

huangapple
  • 本文由 发表于 2023年6月22日 10:20:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76528220.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定