close method

  1. @override
Future<void> close()
override

Closes the server.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • macOS WKWebView
  • Windows WebView2
  • Linux WPE WebKit

Use the PlatformInAppLocalhostServer.isMethodSupported method to check if this method is supported at runtime.

Implementation

@override
Future<void> close() async {
  final server = this._server;
  if (server == null) {
    return;
  }
  await server.close(force: true);
  if (kDebugMode) {
    print('Server running on http://localhost:$_port closed');
  }
  _clearServerReference(server);
}