execute method

Future<CommandResult> execute(
  1. String executable,
  2. List<String> arguments, {
  3. String? workingDirectory,
})

Implementation

Future<CommandResult> execute(
  String executable,
  List<String> arguments, {
  String? workingDirectory,
}) {
  assert(isReady, 'IsolateRunner.init() must be called before execute()');

  final id = _nextId++;
  final completer = Completer<CommandResult>();
  _pending[id] = completer;

  _sendPort!.send(
    IsolateRequest(
      id: id,
      command: IsolateCommand.runCommand,
      executable: executable,
      arguments: arguments,
      workingDirectory: workingDirectory,
    ),
  );

  return completer.future;
}