-
Notifications
You must be signed in to change notification settings - Fork 330
Some initial work for FlutterWeb apps #3315
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
Conversation
@jacob314 Some additional comments and questions will be via email/ our chat. |
src/io/flutter/run/SdkFields.java
Outdated
final FlutterCommand command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args); | ||
|
||
final FlutterCommand command; | ||
if(FlutterUtils.declaresFlutterWeb(root.getPubspec())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
final FlutterCommand command = FlutterUtils.declaresFlutterWeb(root.getPubspec() ?
flutterSdk.flutterRunWeb(root, runMode, false) :
flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args);
is a little simpler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
final RunMode mode = RunMode.fromEnv(env); | ||
final Module module = ModuleUtilCore.findModuleForFile(mainFile.getFile(), env.getProject()); | ||
final LaunchState.CreateAppCallback createAppCallback = (device) -> { | ||
if (device == null) return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does removing this check cause any problems for regular flutter apps?
An alternate that might be more robust is to create a mock ChromeBrowser Device to use for FlutterWeb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it does not as it can't be null unless it is a FlutterWeb execution.
Adding a comment to this effect.
private final @Nullable Module myModule; | ||
private final @NotNull RunMode myMode; | ||
private final @NotNull FlutterDevice myDevice; | ||
// TODO(github.com/flutter/flutter-intellij/issues/3293) myDevice is not-null for all run configurations except flutter web configurations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bug listed doesn't cover the issue. e.g. whether Device should be null for FlutterWeb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the bug URL however is the searchable text that can be used to identify all locations in source that might want to be visited if this expectation switches (with a mocked Chrome device for instance.)
// TODO(github.com/flutter/flutter-intellij/issues/3293) This is a temporary "<pub-cache>/bin/webdev" that can be provided to test some | ||
// webdev directly. | ||
@Nullable | ||
private final String localWebDevExe = "webdev"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be removed before checkin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is up to you and Devon. I'd like to land it to allow you to verify that things work as expected on someone elses' machine.
If your question is: should this be removed before users use it, then yes. This string only exists for line 267 below to change the generation of the command line from FlutterSdk (below) from flutter packages pub global run webdev serve [--debug] [--hot-reload]
to webdev serve
. After the appropriate Dart SDK lands in the Flutter SDK, this field should be removed.
src/io/flutter/sdk/FlutterSdk.java
Outdated
args.add("webdev"); | ||
args.add("daemon"); | ||
if (mode == RunMode.DEBUG) { | ||
//args.add("--debug"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these need to be commented out? I imagine they might apply if/when we support debug mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the dead code and adding a comment.
+ e.toString() + "\n" + | ||
formatStackTraces(e)); | ||
return; | ||
// TODO(github.com/flutter/flutter-intellij/issues/3293) The following check disables the WebSocket connection for all FlutterWeb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add more granularity to this issue. How does this test fail.
If it is needed, check based on whether the app is a FlutterWebApp not based on the device being null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add call in FlutterApp isWebDev
instead of checking for null, and a reference to dart-lang/webdev#233
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this land. a few minor comments and questions.
src/io/flutter/run/SdkRunConfig.java
Outdated
final RunMode mode = RunMode.fromEnv(env); | ||
final Module module = ModuleUtilCore.findModuleForFile(mainFile.getFile(), env.getProject()); | ||
final LaunchState.CreateAppCallback createAppCallback = (device) -> { | ||
// Up until the FlutterWeb support, device was checked for null and returned. The device can only be null if this is a FlutterWeb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: wrap comments at 80 chars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped
} | ||
|
||
public boolean isWebDev() { | ||
return myDevice == null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a TODO that this is a temp hack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO added
This reverts commit 2595b1b.
No description provided.