use of io.flutter.sdk.FlutterCommand in project flutter-intellij by flutter.
the class SdkFields method createFlutterSdkRunCommand.
/**
* Create a command to run 'flutter run --machine'.
*/
public GeneralCommandLine createFlutterSdkRunCommand(@NotNull Project project, @Nullable FlutterDevice device, @NotNull RunMode mode) throws ExecutionException {
final MainFile main = MainFile.verify(filePath, project).get();
final FlutterSdk flutterSdk = FlutterSdk.getFlutterSdk(project);
if (flutterSdk == null) {
throw new ExecutionException(FlutterBundle.message("flutter.sdk.is.not.configured"));
}
final PubRoot root = PubRoot.forDirectory(main.getAppDir());
if (root == null) {
throw new ExecutionException("Entrypoint isn't within a Flutter pub root");
}
String[] args = additionalArgs == null ? new String[] {} : additionalArgs.split(" ");
if (buildFlavor != null) {
args = ArrayUtil.append(args, "--flavor=" + buildFlavor);
}
final FlutterCommand command = flutterSdk.flutterRun(root, main.getFile(), device, mode, args);
return command.createGeneralCommandLine(project);
}
Aggregations