Repository navigation
Support debug mode for WASM builds #148850
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: wasmIssues related to the wasm build of Flutter Web.Issues related to the wasm build of Flutter Web.found in release: 3.22Found to occur in 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Description
Steps to reproduce
- Create a new project
- Call
print(kDebugMode) - Run
flutter run --debug -d chrome --wasm - It prints false
Expected results
It prints true
Actual results
It prints false
Code sample
Code sample
import 'package:flutter/foundation.dart';
void main() {
print(kDebugMode);
}Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
rexios@Aarons-MBP pub_stats % flutter doctor -v
[✓] Flutter (Channel main, 3.22.0-42.0.pre.6, on macOS 14.5 23F79 darwin-arm64, locale en-US)
• Flutter version 3.22.0-42.0.pre.6 on channel main at /Users/rexios/repos/flutter
• Upstream repository [email protected]:flutter/flutter.git
• Framework revision 112e8b5509 (4 hours ago), 2024-05-22 09:25:21 +0200
• Engine revision c89defa558
• Dart version 3.5.0 (build 3.5.0-177.0.dev)
• DevTools version 2.36.0-dev.10
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/rexios/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio Preview.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version unknown)
• Android Studio at /Applications/Android Studio Preview.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to determine Android Studio version.
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
[✓] VS Code (version 1.89.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.88.0
[✓] Connected device (4 available)
• Aaron’s iPhone (mobile) • 00008130-001C35CE3A20001C • ios • iOS 17.5.1 21F90
• macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.208
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work liste: wasmIssues related to the wasm build of Flutter Web.Issues related to the wasm build of Flutter Web.found in release: 3.22Found to occur in 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamOwned by Web platform teamtriaged-webTriaged by Web platform teamTriaged by Web platform team
Activity
darshankawar commentedon May 22, 2024
@Rexios80 According to https://docs.flutter.dev/platform-integration/web/wasm#only-build-support, currently wasm has only build support and not
flutter run, so could be that you are seeing the reported behavior.Rexios80 commentedon May 22, 2024
I am running the latest Flutter main commit which does support
flutter run. Should I not report issues with using it?darshankawar commentedon May 23, 2024
Thanks for the feedback. It seems the said command doesn't work in stable yet, so I thought to refer the documentation if that's the case, but I checked in master which ran the command and printed false as below:
Keeping the issue open and labeling for team's tracking.
8 remaining items
eyebrowsoffire commentedon Jun 4, 2024
It is hot restart, not hot reload, and it does actually work. If you make a change to the code and then press "r", it will recompile the code and send a signal to chrome to reload, and it will do so. This is the existing behavior for
flutter build web --release, which uses dart2js.Yes. Wasm compilation does not support debug mode currently.
Rexios80 commentedon Jun 10, 2024
Is there an existing issue to support debug mode in WASM builds or should we repurpose this one to be it?
Rexios80 commentedon Jul 11, 2024
@eyebrowsoffire sorry for the ping but I would like to clarify this if possible. Should we create an issue to support debug mode in WASM builds or is there already an existing issue for that?
eyebrowsoffire commentedon Jul 11, 2024
Let's repurpose this bug to track that.
[-]`kDebugMode` is false when running `flutter run --debug -d chrome --wasm`[/-][+]Support debug mode for WASM builds[/+]Rexios80 commentedon Jul 23, 2024
@eyebrowsoffire What is the reason we can't just make
kDebugModetrue withflutter run --wasmand false withflutter run --wasm --release? Are there bigger implications that I'm not seeing? The biggest use-case for this in my projects is using Firebase emulators whenkDebugModeis true, which makes testing locally with WASM really annoying.eyebrowsoffire commentedon Jul 23, 2024
We can do as you're suggesting, I just haven't implemented it yet. The reason it is the way it is right now is just mostly implementation warts. I plan on at least making it so that
kDebugModeis true here, even if you won't get a full "debug mode" experience (attaching devtools, etc).Set dart defines properly while in debug mode. (#152262)
eyebrowsoffire commentedon Jul 25, 2024
Fixed with #152262
Rexios80 commentedon Jul 26, 2024
Confirmed
kDebugModeis true when runningflutter run -d chrome --wasmon Flutter masterSet dart defines properly while in debug mode. (flutter#152262)
github-actions commentedon Aug 9, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.