我的Flutter项目是:here。当我尝试运行Rahulraj
分支中的代码时,我得到以下错误:
/C:/Users/Sanmitha/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_screenutil-5.6.1/lib/src/screen_util.dart:64:16: Error: The getter 'viewConfiguration' isn't defined for the class 'FlutterView'.
- 'FlutterView' is from 'dart:ui'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'viewConfiguration'.
if (window.viewConfiguration.geometry.isEmpty) {
^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1153
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 6s
Exception: Gradle task assembleDebug failed with exit code 1
谁能帮我解决这个问题???求你了?
3条答案
按热度按时间ktecyv1j1#
更新:flutter_screenutil更新了,请使用实际版本(5.7.0+)。
=原始答案=======================================================================================================================================================================================================================================================
问题出现在最后一次Flutter更新中:https://github.com/flutter/flutter/issues/121742.中的FlutterView. viewConfiguration属性被删除,但它在flutter_screenutil库中使用。
可能的解决方案:
一般建议使用稳定Flutter通道而不是主通道。
4dc9hkyq2#
此错误发生在Flutter的最新版本(3.9.0-1.0)(2023年3月)中。可能的解决方案是,
1.使用Flutter Version Manager(fvm)https://pub.dev/packages/fvm降级项目中flutter的版本。
flutter pub global activate fvm
或者.. 2.删除这个软件包flutter_screenutil并使用不同的选项如MediaQuery.
OR.. 3.降级Flutter
flutter downgrade v1.17.0
hpxqektj3#
更新flutter_screenutil库到最新版本。
https://pub.dev/packages/flutter_screenutil/install