StrartServer function

Future<void> StrartServer(
  1. String address,
  2. int port
)

Implementation

Future<void> StrartServer(String address, int port) async {
  try {
    server = await shelf_io.serve(Cascade().add(app).handler, address, port);

    server!.autoCompress = true;

    print('Serving at http://${server!.address.host}:${server!.port}');
  } on SocketException catch (_, e) {
    var istrue = _.osError!.errorCode == 98;
    if (istrue) {
      stopserver();
      server = null;
    }
  }
}