runCommand function

Future<ResultSet> runCommand(
  1. String command,
  2. {int outputType = ShellCommand.CMD_STATUS_CODE}
)

runCommand() execute the Native commands with respect to platform like Windows,MacOS,Linux command, the command to execute outputType, 0-default, returns only output status 1, return status and response of command

Implementation

Future<ResultSet> runCommand(String command,
    {int outputType = ShellCommand.CMD_STATUS_CODE}) async {
  assert(command != null && command.trim().isNotEmpty);
  assert(outputType == ShellCommand.CMD_STATUS_CODE ||
      outputType == ShellCommand.CMD_RESPONSE);

  List data = [command, outputType];
  final String _response = await _channel.invokeMethod('runCommand', data);
  List<String> list = _response.split(":#");
  ResultSet resultSet = ResultSet(list[0], list[1]);
  return resultSet;
}