Flutter Web crashes with Cannot open file client.js - flutter

May I ask your help about this error
It's happen when I'm trying for the first time running my flutter web which using flutter run -d chrome
Launching lib\main.dart on Chrome in debug mode...
Syncing files to device Chrome...
25,220ms (!)
GET /dwds/src/injected/client.js
Error thrown by handler.
FileSystemException: Cannot open file, path = 'C:\Users\Acer\flutter\.pub-cache\hosted\pub.dartlang.org\dwds-2.0.1\lib\src\injected\client.js' (OS Error: The system cannot find the path specified.
, errno = 3)
dart:isolate _RawReceivePortImpl._handleMessage
And if I trying run using
flutter run -d web
It's doesn't thrown any error but on the website it goes blank white nothing shown up.
Anyway thanks for your help

adding the following in the pubspec.yaml worked for me. I am using beta channel.
dependencies:
dwds: ^16.0.1
then run command:
flutter update-packages

I was also facing the same issue, I don't know the exact root cause of the problem but I have a hack to make it work.
I was facing the issue after I deleted .pub-cache folder, so from my recycler bin I picked dwds-2.0.1 folder and reverted back. This hack working

add dwds package in your dependencies and run flutter update-packages. It will work :)

Related

I have issue when creating my first flutter app

After creating my app on flutter, I tried to create an app file from it ..
But I keep getting an error which says "flutter.bat failed to run. System cannot find the path specified at line1 char1"
I don't know if there's a solution to that.enter image description here
run flutter doctor -v and discard what it produces.
And try to fix your project, for this call
flutter create project_name for the folder where the root project is located.

Unable to create flutter project

When running flutter create followed by project name, I receive this error:
Error: Error when reading '../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No such file or directory
Running "flutter pub get" in pics...
pub get failed (254; Error: Error when reading
'../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No
such file or directory)
I'm trying to create a new flutter project in xcode. How would I fix this?
'../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No
such file or directory
It seems like there may be files missing from your Flutter SDK. There should be a file in the Flutter SDK at bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot but this error suggests it's missing.
The easiest fix may be to delete the bin/cache folder which will cause Flutter to re-download the Dart SDK and other components when you next run flutter. This may take a little while depending on your connection, but is the simplest way to ensure the cache folder is complete. I would suggest closing all IDEs/editors when doing this.
I have same issue but the problem was windows defender at real time detection so the solution was to switch off it then create a project...

Flutter: I have changed the Dart entrypoint to Login.dart , while building apks error shows that lib\main.dart not found

C:\flutter\flutter_windows_v1.9.1+hotfix.2-stable\flutter\bin\flutter.bat --no-color build apk
Target file "lib\main.dart" not found.
Process finished with exit code 1
You can set an entry point like this:
flutter run --target=lib/Login.dart
flutter build apk --target=lib/Login.dart
This article shows you how to set up IDE (VSCode/AS) to build another target file.
I don't think you should be changing the entry file, you can always use the main.dart without issues and then set the Entry class there. This doesn't stop your app from working.

new flutter project in vscode has error

when i create a new flutter project in vscode it will immediately shows an error in the main.dart file and gives a gradle error when trying to debug.
shown here: main.dart error
"compiler message: lib/main.dart:68:19: Error: Too few positional arguments: 1 required, 0 given."
I've reinstalled dart and flutter plugins. updated the java install.
in debug console i get this:
debug console
added output of flutter doctor -v
enter image description here
I was also facing the same error, but it was always on my test folder.
This is what I did:
On your terminal, make sure you are in your project repository.
Run the flutter pub get command, it worked for me, may be you
should try it too.
Do you possibly have two different versions of the Flutter SDK on your machine? I wonder if one is being used by flutter create and the other for analysis.
If you're sure you only have one, please open an issue on GitHub and attach a log file for me to investigate.

When I try to run flutter doctor or any flutter command, its giving error

When I try to run flutter doctor or any flutter command, it doesn't run and giving me this error. I've even deleted .gitconfig file from my system but still having same issue. I am using Flutter on my window pc Window 10
fatal: bad config line 1 in file .git/config
Updating flutter tool...
Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Failed to send crash report. Server responded with HTTP status code 400
Crash report written to C:\Users\DTI-3\flutter_03.log;
please let us know at https://github.com/flutter/flutter/issues.
I've deleted the config file from C:\flutter\.git flutter folder and tried with flutter doctor command. its working fine for me now. Earlier I was trying to make it run by deleting config file from another location, delete the file from flutter folder(flutter sdk path).