close method

void close([
  1. int? status,
  2. String? reason
])

Implementation

void close([int? status, String? reason]) {
  // This weird code is fault of web package, they are not using null safety yet
  // See https://github.com/dart-lang/web/blob/main/web/lib/src/dom/websockets.dart#L60
  if (status != null && reason != null) {
    socket?.close(status, reason);
  } else if (status != null) {
    socket?.close(status);
  } else {
    socket?.close();
  }
}