skip to Main Content

My flutter project is : here. When I try to run the code present in the Rahulraj branch, I get the following error:

/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:flutterpackagesflutter_toolsgradleflutter.gradle' line: 1153

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:flutterbinflutter.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

Could anyone help me to debug this issue??? Please..?

2

Answers


  1. Update: flutter_screenutil is updated, just use the actual version (5.7.0+).

    = Original answer ==========================================

    The issue is in the last flutter update:
    https://github.com/flutter/flutter/issues/121742. Property FlutterView.viewConfiguration in is removed, but it’s used in flutter_screenutil library.

    Possible solutions:

    • rollback to any previous version of Flutter
    • link this library form my fork of flutter_screenutil, where this issue is fixed (only temporary soluion!, return the dependency back as soon as flutter_screenutil will be updated):
      flutter_screenutil:
        git:
          url: https://github.com/dmakeev/flutter_screenutil
          ref: fix-463
    

    General recommendation is to use a Stable Flutter channel instead of Master.

    Login or Signup to reply.
  2. This error is occurring in the Latest Version(3.9.0-1.0) of Flutter (March 2023) .
    The Possible Solution to this is,

    1. Use Flutter Version Manager(fvm) https://pub.dev/packages/fvm to downgrade the version of flutter in project.
      simply flutter pub global activate fvm

    OR..
    2. Remove this package flutter_screenutil and use different options like MediaQuery.

    OR..
    3. Downgrade flutter flutter downgrade v1.17.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search