flutter devtools websocket exception websocket connection failed - flutter

I am trying to use flutter devtools using android issue. I have valid url: http://127.0.0.1:9200/13hh2pxQQ-Q=/ generated through android studio itself while running the program. Still, whenever i tried to connect to devtools , i get the error as specified in the image.

Related

Flutter Web app stuck on startup and splash screen

Flutter web app stuck on startup.
Cause:
ChromeProxyService: Failed to evaluate expression 'ui.webOnlyWarmupEngine': InternalError: Expression evaluation in async frames is not supported. No frame with index 163..
Same problem on Chrome and on command flutter run -d web-server and open using Brave Browser localhost page.
How I can avoid it? I remove splash screen from code and pubspec.yaml, then run flutter clean, but this error still exist.
Any ideas?
EDIT:
Same problem on:
Flutter version 3.3.0 on channel stable
and
Flutter version 3.5.0-6.0.pre.64 on channel master

ui.TextLeadingDistribution not found when running Flutter app on chrome or macos

When trying to run my app on chrome or macos after using dart migrate, I get this errors in the console:
Downloading Web SDK... 2,674ms
Launching lib/web/main.dev.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:38:7: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? leadingDistribution,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:98:7: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? leadingDistribution,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:219:3: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? get leadingDistribution =>
It runs fine on the Android / iPhone emulators.
I tried the following but all in vain:
flutter 2.0.6 (stable)
flutter 2.5.3 (stable)
flutter doctor shows nothing wrong
flutter clean, flutter pub cache repair, flutter pub get
Restart VSCode
Actually, the issue was coming from the dependency styled_text.
I copied only the files that we needed from the repo and that solved the issue.

Why won't my Flutter web app debug open in the browser?

In VScode, I used to be able to go 'Run' -> 'Run without debugging' and if the 'Web server (web-javascript)' was chosen then the Flutter app would open in debug mode in Chrome. This used to open a new Chrome window for the app to be displayed in. I'm not sure what I've done but this no longer works. I now get the message below showing in the debug console. I have tried to go to the localhost link in Chrome but I just get a blank screen and no errors in the Chrome console. I've tried downloading the Dart extension in Chrome but this doesn't help.
Launching lib\main.dart on Web Server in debug mode...
Waiting for connection from Dart debug extension at http://localhost:51367
So far I have tried reinstalling VScode and Flutter, reinstalling the Dart and Flutter extensions. I've even tried to uninstall VScode and remove all the extension and settings files that get left behind (like mentioned here). I've set Flutter up as the Flutter website says every time but none of this has helped and I have no idea what has gone wrong. Could anyone help?
In case it helps, here is the Flutter doctor output:
Downloading android-arm-profile/windows-x64 tools... 1.7s
Downloading android-arm-release/windows-x64 tools... 0.8s
Downloading android-arm64-profile/windows-x64 tools... 1.2s
Downloading android-arm64-release/windows-x64 tools... 1.3s
Downloading android-x64-profile/windows-x64 tools... 2.2s
Downloading android-x64-release/windows-x64 tools... 1.0s
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, 1.20.0-7.3.pre, on Microsoft Windows [Version 10.0.18362.959], locale en-GB)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.0)
[√] VS Code (version 1.47.3)
[√] Connected device (2 available)
• No issues found!
The problem for me was in the index.html file located in the "web" folder.
The cause for the error was my <script src="main.dart.js" type="application/javascript"></script> line. It was not at the very bottom of the body tag. Moving it to the bottom fixed the issue.
You might also need to re-check the index.html file in general. The general order inside the body tag should be as follows:
1-
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
2- (applies to firebase users) Firebase CDN scripts. ex:
<script src="https://www.gstatic.com/firebasejs/7.20.0/firebase-app.js"></script>
3- (Firebase users)
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "<your api key>",
authDomain: "<your auth domain>",
projectId: "<Your project id>",
messagingSenderId: "<your messaging sender id>",
appId: "<your app id>"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
</script>
4- (most importantly) Make sure this line is at the bottom of the body tag
<script src="main.dart.js" type="application/javascript"></script>
I had to rerun flutter config --enable-web after an upgrade to get it working again. Then restart vscode and run.
For me. All I had to do was to make sure that Chrome was the default browser.
if you want to run your flutter web code in a specific port or..., you will see this error.
The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
Please click the Dart Debug extension button in the spawned browser window
you can easily install dart extension from dart-extention and click on it every time you run your code.
Last resort (maybe someone has a better solution). Make a new project and copy the lib across. Add anything needed in the pubspec.yaml
Simply open a new tab with the flutter app URL.
For me, I used an old project that has Android build files. I did the following
flutter config --enable-web
flutter clean
restarting vscode
It solved the problem.
I solved it after upgrading flutter to 3.0v.
flutter upgrade
Just in case anyone has facing this issue in vscode devcontainer, I had a hard time trying to figure out what was happening, I tried everything, flutter clean, forwarding port in devcontainer. It just happened that the version of flutter that i was using had the issue. I was using 3.6 and change to 3.9, everything is working right now.
I was getting a white blank screen and debug console said this
Running "flutter pub get" in flutter_application_1...
Launching lib/main.dart on Web Server in debug mode...
lib/main.dart:1
Waiting for connection from Dart debug extension at http://localhost:42207
The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
Please click the Dart Debug extension button in the spawned browser window
flutter run -d web-server in cmd line worked for me though I have to press 'r' manually to reload
If running on the web check the web console. I had a js function that double declared "index".

Issue with Flutter commands after Flutter upgrade

My project was working okay before I got Flutter upgrade prompt. After accepting to upgrade flutter, I started getting the following exception and now with every flutter command I get this exception. Also since that problem started Android Studio does not pick up any running emulator. So basically, I'm stuck, please help. It just displays "Loading..." instead of displaying the running Emulator.
Version Information:
Android Studio 3.4.2 • Flutter plugin io.flutter 38.2.1 • Dart plugin 183.6270
I've change the permission for git.EXE to allow for read, execute etc but this has not helped.
ERROR MESSAGE:
CreateProcessW failed 5
Unhandled exception:
ProcessException: Access is denied.
I have faced the same issue after running the flutter upgrade command
Remove exiting flutter SDK from the directory "https://flutter.dev/docs/get-started/install" and download again and run the following command
flutter doctor -v
After running the flutter upgrade command in the Windows CMD I faced the same issue.
I then tried to upgrade Flutter SDK using the Android Studio terminal and it upgraded successfully.

flutter run with flutter create app throws error

when I run the flutter create default app . my app is running but getting an error and it quits.
The error is :
Error connecting to the service protocol: HttpException: Connection closed before full header was received while flutter run http://127.0.0.1:64730/WQfPVkoQWyk=/
How to resolve this issue?
If you are using the emulator then changing the Android version from Q to Pie should solve the issue. This issue is addressed here