start method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform(), WindowsPlatform(), LinuxPlatform()])
Future<void> start()

Starts the server on http://localhost:[port]/.

NOTE for iOS: For the iOS Platform, you need to add the NSAllowsLocalNetworking key with true in the Info.plist file (See ATS Configuration Basics):

<key>NSAppTransportSecurity</key>
<dict>
   <key>NSAllowsLocalNetworking</key>
   <true/>
</dict>

The NSAllowsLocalNetworking key is available since iOS 10.

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

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(),
    IOSPlatform(),
    MacOSPlatform(),
    WindowsPlatform(),
    LinuxPlatform(),
  ],
)
Future<void> start() {
  throw UnimplementedError(
    'start is not implemented on the current platform',
  );
}