Flutter - Error Compiling project without changes - flutter

I am facing an issue in flutter for a couple of days
before I close Android Studio everything was working fine with no errors so far, next day I started it with no changes, and it shows me an error message and cannot compile while there is no errors in my code or in anything
../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart:171:14:
Error: The method 'FlatButton' isn't defined for the class
'PlatformDialogAction'.
'PlatformDialogAction' is from 'package:flutter_platform_widgets/src/platform_dialog_action.dart'
('../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart').
Try correcting the name to the name of an existing method, or defining
a method named 'FlatButton'.
return FlatButton(
^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:269:14:
Error: The method 'FlatButton' isn't defined for the class
'PlatformButton'.
'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart'
('../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
Try correcting the name to the name of an existing method, or defining
a method named 'FlatButton'.
return FlatButton(
^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:302:12:
Error: The method 'RaisedButton' isn't defined for the class
'PlatformButton'.
'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart'
('../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
Try correcting the name to the name of an existing method, or defining
a method named 'RaisedButton'.
return RaisedButton(
^^^^^^^^^^^^ Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line:
1151
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 10s Exception: Gradle task assembleDebug failed with
exit code 1
I tried to restart, search, and made everything but then nothing worked for me
Does anybody have an idea why is that happening?
thanks in advance

Related

Accidently replaced '.r' through whole app with '' in flutter project

I had lots of reference of '.r' through my flutter app and I replaced all '.r' references with '' empty string and I came to to know that dart files also have been modified and now I get these errors in my debug console. I tried to fix these but seems like re-adding '.r' isn't fixing these problems.
Debug Console:
Launching lib\main.dart on sdk gphone x86 in debug mode...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/lib/src/path_provider_windows_real.dart:117:66: Error: Member not found: 'roamingAppData'.
final String? appDataRoot = await
getPath(WindowsKnownFolder.roamingAppData);
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/lib/src/path_provider_windows_real.dart:146:60: Error: The method 'rsetGUID' isn't defined for the class 'GUID'.
'GUID' is from 'package:win32/src/guid.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/win32-3.0.1/lib/src/guid.dart').
Try correcting the name to the name of an existing method, or defining a method named 'rsetGUID'.
final Pointer knownFolderID =
calloc().ref.rsetGUID(folderID);
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/lib/src/path_provider_windows_real.dart:235:5: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
.replaceAll(RegExp(r'[<>:"/\\|?*]'), '_');
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/lib/src/path_provider_windows_real.dart:237:9: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
.trimRight();
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/lib/src/path_provider_windows_real.dart:239:5: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
.replaceAll(RegExp(r'[<>:"/\|?*]'), '_');
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
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 10s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

Flutter Run : FAILURE Build failed with an exception

Please help me. Since I cloned this project from git I always get the following error message
../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/encoder/tex/functions/frac.dart:113:37: Error: The getter 'optionsDiff' isn't defined for the class 'GreenNode'.
- 'GreenNode' is from 'package:flutter_math_fork/src/ast/syntax_tree.dart' ('../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/ast/syntax_tree.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'optionsDiff'.
final remainingOptions = node.optionsDiff.removeStyle();
^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/encoder/tex/functions/frac.dart:138:37: Error: The getter 'optionsDiff' isn't defined for the class 'GreenNode'.
- 'GreenNode' is from 'package:flutter_math_fork/src/ast/syntax_tree.dart' ('../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/ast/syntax_tree.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'optionsDiff'.
final remainingOptions = node.optionsDiff.removeStyle();
^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* Where:
Script 'C:\SRC\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDevDebug'.
> 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 8s
Running Gradle task 'assembleDebug'... 9.6s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried
flutter pub get
flutter clean
But still, get the error message above. I am getting error messages only in this project. if I do flutter run in another project it can run without problem.

Error: The getter 'SystemMouseCursors' isn't defined for the class '_LegendItemState'

I'm using Flutter to code the frontend interface of my App but I got this problem. I don't get it, can you help me understand the error ?
The error :
../../Documents/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-19.4.56/lib/src/legend/legend.dart:1329:21: Error: The getter 'SystemMouseCursors' isn't defined for the class '_LegendItemState'.
'_LegendItemState' is from 'package:syncfusion_flutter_core/src/legend/legend.dart' ('../../Documents/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-19.4.56/lib/src/legend/legend.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'SystemMouseCursors'. cursor: SystemMouseCursors.click, ^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
Where: Script '/Users/macbookpro/Documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/macbookpro/Documents/flutter/bin/flutter'' 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 20s Exception: Gradle task assembleDebug failed with exit code 1

Flutter - build failed in

run code after one year then face this issue
when flutter run command then command response error
how can remove these error
also run command flutter create -t app
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.3.3+1/lib/src/widgets/selectable.dart:407:7: Error: The non-abstract class 'InternalSelectableMathState' is missing implementations for these members:
TextSelectionDelegate.copySelection
TextSelectionDelegate.cutSelection
TextSelectionDelegate.pasteText
TextSelectionDelegate.selectAll
Try to either
provide an implementation,
inherit an implementation from a superclass or mixin,
mark the class as abstract, or
provide a 'noSuchMethod' implementation.
class InternalSelectableMathState extends State
^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_input.dart:1034:8: Context: 'TextSelectionDelegate.copySelection' is defined here.
void copySelection(SelectionChangedCause cause);
^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_input.dart:1014:8: Context: 'TextSelectionDelegate.cutSelection' is defined here.
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 25s
Running Gradle task 'assembleDebug'... 26.1s
Exception: Gradle task assembleDebug failed with exit code 1
Well, I hate bringing you bad news, but Flutter received a LOT of updates. You might want to either
Use an older version of Flutter (see: THIS LINK)
Refactor your code to adhere to the changes

Error: The getter 'hellawait' isn't defined for the class 'IOClient'

I created and run a location and weather based app. But when I closed the VS Code and try to reinstall the app, the following error occurred!.
How to remove the error!.
Launching lib\main.dart on Infinix X655C in debug mode...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:34: Error: Expected ')' before this.
var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:24: Error: The getter 'hellawait' isn't defined for the class 'IOClient'.
- 'IOClient' is from 'package:http/src/io_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'hellawait'.
var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* 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 50s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I know its a bit ago, but
flutter pub cache repair
helped me