resolveControllerLaunch function

ControllerLaunchCommand resolveControllerLaunch({
  1. String? resolvedExecutable,
  2. Uri? scriptUri,
})

Implementation

ControllerLaunchCommand resolveControllerLaunch({
  String? resolvedExecutable,
  Uri? scriptUri,
}) {
  final executable = resolvedExecutable ?? Platform.resolvedExecutable;

  if (isDartVmExecutable(executable)) {
    final localController = _findLocalControllerEntrypoint(
      scriptUri: scriptUri ?? Platform.script,
    );
    if (localController != null) {
      return ControllerLaunchCommand(
        executable,
        [localController],
      );
    }
    return const ControllerLaunchCommand('fdb-controller', []);
  }

  if (isStandaloneFdbExecutable(executable)) {
    return ControllerLaunchCommand(
      executable,
      const [internalControllerFlag],
    );
  }

  return const ControllerLaunchCommand('fdb-controller', []);
}