Flutter _输入:未定义FocusTapArea

uyhoqukh  于 2023-01-18  发布在  Flutter
关注(0)|答案(2)|浏览(171)

升级到Flutter 3.1.x后,flutter_pinput包不再工作了。任何建议都是有帮助的。它在flutter 2.x.x中工作得很好。我试过用flutter pub cache repair修复该高速缓存,也试过用flutter clean清理项目缓存。它仍然不工作。

/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pinput-2.2.11/lib/src/pinput_state.dart:334:14: Error: The method 'FocusTrapArea' isn't defined for the class '_PinputState'.
         - '_PinputState' is from 'package:pinput/src/pinput.dart' ('/C:/Users/Administrator/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/pinput-2.2.11/lib/src/pinput.dart').
        Try correcting the name to the name of an existing method, or defining a method named 'FocusTrapArea'.
              child: FocusTrapArea(
                     ^^^^^^^^^^^^^
        
        
        FAILURE: Build failed with an exception.
        
        * Where:
        Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
        
        * What went wrong:
        Execution failed for task ':app:compileFlutterBuildDebug'.
        > Process 'command 'D:\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 27s
        Running Gradle task 'assembleDebug'...                             29.0s
        Exception: Gradle task assembleDebug failed with exit code 1

版本信息:

Flutter 3.1.0-0.0.pre.2085 • channel master • https://github.com/flutter/flutter.git
Framework • revision 74aef9ff87 (8 hours ago) • 2022-08-04 02:00:08 -0400
Engine • revision e32e0d217b
Tools • Dart 2.19.0 (build 2.19.0-62.0.dev) • DevTools 2.16.0
lpwwtiir

lpwwtiir1#

才能切换到稳定频道。
flutter channel stable && flutter upgrade

ttcibm8c

ttcibm8c2#

我在开发时遇到了同样的问题,只是为了测试问题,我确实将包中导致错误的行从FocusTrapArea修改为Focus,我的代码运行时没有错误,但这只是在开发模式下使用

相关问题