Flutter error Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102

927

I had the same issue after restarting my PC.

try any of the following:

upgrade your dependencies in your pubspec.yaml

or

try flutter flutter clean then flutter run

lastly, if it didn't work you've to delete the flutter src folder in Script 'C:\src\flutter and reinstall it again

make sure the path you created your flutter project have no spaces.

Share:
927
Jacob Jagiello
Author by

Jacob Jagiello

Updated on January 04, 2023

Comments

  • Jacob Jagiello
    Jacob Jagiello over 1 year

    Hello I have a flutter error although i dont have any bugs in code. This is all error:

    /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
        return super.inheritFromElement(ancestor, aspect: aspect);
                     ^^^^^^^^^^^^^^^^^^
    /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
     - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
            ? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
     - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
            : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
    
    * What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.
    > Process 'command 'C:\src\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 12s
    Exception: Gradle task assembleDebug failed with exit code 1

    error code

    I downgrade the version to 1.12.15 and steal nothing

    • Cody Gray
      Cody Gray about 2 years
      Please check out our formatting help so you can edit your question to make it more readable. Hint: put code fences around build output.
  • Harsha
    Harsha about 2 years
    Could you tell me where you can find the src folder in ubuntu? Is it the directory where the flutter sdk is extracted?
  • programmer
    programmer about 2 years
    flutter doctor -v The first line will show the install path...