Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: The getter 'mounted' isn't defined for the class 'BuildContext'. #133

Closed
Jackson-Antunes-Sampaio opened this issue Feb 7, 2023 · 1 comment

Comments

@Jackson-Antunes-Sampaio
Copy link

after updating to version 4.0.0 i had the problem below:

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_foreground_task-4.0.0/lib/ui/will_start_foreground_task.dart:76:33: Error: The getter 'mounted' 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 getter, or defining a getter or field named 'mounted'.
    final bool canPop = context.mounted ? Navigator.canPop(context) : false;
    ^^^^^^^
    /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_foreground_task-4.0.0/lib/ui/with_foreground_task.dart:21:33: Error: The getter 'mounted' 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 getter, or defining a getter or field named 'mounted'.
    final bool canPop = context.mounted ? Navigator.canPop(context) : false;
    ^^^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

  • 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 35s
Exception: Gradle task assembleDebug failed with exit code 1

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [versÆo 10.0.19045.2486], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Professional 2022 17.4.3)
[√] Android Studio (version 2021.2)
[!] Android Studio (version 4.2)
X Unable to determine bundled Java version.
[√] VS Code (version 1.75.0)
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 1 category.

Dev-hwang added a commit that referenced this issue Feb 7, 2023
@Dev-hwang
Copy link
Owner

@Jackson-Antunes-Sampaio

Sorry. There was a small mistake. Try flutter_foreground_task: ^4.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants