编译 flutter 时的 ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt

Dol*_*hin 2 dart

当我编译我的 flutter 项目时,它显示:

To see a detailed report, use the --untranslated-messages-file 
option in the tool to generate a JSON format file containing 
all messages that need to be translated.
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
e: /home/dolphin/apps/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-7.1.5/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt: (16, 16): Redeclaration: MethodCallHandlerImpl
e: /home/dolphin/apps/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-7.1.6/android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt: (17, 16): Redeclaration: MethodCallHandlerImpl

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':fluttertoast:compileDebugKotlin'.
> Compilation error. See log for more details

* 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 7s
Exception: Gradle task assembleDebug failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

现在工作正常,然后我尝试升级 fluttertoast

  fluttertoast: ^7.1.6
Run Code Online (Sandbox Code Playgroud)

但仍然不起作用,我应该做什么来解决它?

小智 5

将其更改为 fluttertoast: 7.1.5 Run Pub get 并运行您的项目之后,您可以更改为 fluttertoast: ^7.1.6 显然,这不是修复此错误的最佳方法,但它对我有用。祝你好运