start method
Starts the server and binds it to the specified IP and port.
If config.noStop
is true, the server will run within a guarded zone to handle errors.
Otherwise, it runs normally.
Returns a Future containing the HttpServer instance.
If awaitCommands
is true, it will also handle command-line inputs.
Implementation
Future<HttpServer> start([List<String>? args, bool awaitCommands = true]) {
_args = args ?? [];
if (config.noStop) {
return runZonedGuarded(
() => _run(args, awaitCommands: awaitCommands),
(error, stack) {
Console.e({
'error': error,
'stack': stack.toString().split("#"),
});
},
)!;
} else {
return _run(args);
}
}