serveDevToolsWithArgs method

Future<HttpServer?> serveDevToolsWithArgs(
  1. List<String> arguments, {
  2. Handler? handler,
  3. String? customDevToolsPath,
})

Wraps serveDevTools arguments parsed, as from the command line.

For more information on handler, see serveDevTools.

Implementation

// Note: this method is used in google3 as well as by DevTools' main method.
Future<HttpServer?> serveDevToolsWithArgs(
  List<String> arguments, {
  shelf.Handler? handler,
  String? customDevToolsPath,
}) async {
  ArgResults args;
  final verbose = arguments.contains('-v') || arguments.contains('--verbose');
  final argParser = buildArgParser(verbose: verbose);
  try {
    args = argParser.parse(arguments);
  } on FormatException catch (e) {
    print(e.message);
    print('');
    _printUsage(argParser);
    return null;
  }

  return await _serveDevToolsWithArgs(
    args,
    verbose,
    handler: handler,
    customDevToolsPath: customDevToolsPath,
  );
}