Skip to content

Conversation

jwren
Copy link
Member

@jwren jwren commented Mar 25, 2019

No description provided.

@jwren
Copy link
Member Author

jwren commented Mar 25, 2019

@jacob314 Some additional comments and questions will be via email/ our chat.

final FlutterCommand command = flutterSdk.flutterRun(root, main.getFile(), device, runMode, flutterLaunchMode, project, args);

final FlutterCommand command;
if(FlutterUtils.declaresFlutterWeb(root.getPubspec())) {
Copy link
Contributor

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

Copy link
Member Author

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;
Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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.

Copy link
Member Author

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";
Copy link
Contributor

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?

Copy link
Member Author

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.

args.add("webdev");
args.add("daemon");
if (mode == RunMode.DEBUG) {
//args.add("--debug");
Copy link
Contributor

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.

Copy link
Member Author

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
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

@jacob314 jacob314 left a 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.

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
Copy link
Contributor

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.

Copy link
Member Author

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;
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO added

@jwren jwren merged commit 2595b1b into flutter:master Mar 27, 2019
jacob314 added a commit to jacob314/flutter-intellij that referenced this pull request Mar 28, 2019
jacob314 added a commit that referenced this pull request Mar 28, 2019
alexander-doroshko pushed a commit to alexander-doroshko/flutter-intellij that referenced this pull request Jan 24, 2020
* Some initial work for FlutterWeb apps

* comments from @jacob314

* 2 more nit comments from @jacob314
alexander-doroshko pushed a commit to alexander-doroshko/flutter-intellij that referenced this pull request Jan 24, 2020
@jwren jwren deleted the FlutterWeb-run-config-02 branch October 18, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants