prewarmConnections static method

Future<PrewarmingToken?> prewarmConnections(
  1. List<WebUri> URLs
)

Prewarms a connection to each URL. SFSafariViewController will automatically use a prewarmed connection if possible when loading its initial URL.

Returns a token object that corresponds to the requested URLs. You must keep a strong reference to this token as long as you expect the prewarmed connections to remain open. If the same server is requested in multiple calls to this method, all of the corresponding tokens must be invalidated or released to end the prewarmed connection to that server.

This method uses a best-effort approach to prewarming connections, but may delay or drop requests based on the volume of requests made by your app. Use this method when you expect to present the browser soon. Many HTTP servers time out connections after a few minutes. After a timeout, prewarming delivers less performance benefit.

URLs - the URLs of servers that the browser should prewarm connections to. Only supports URLs with http:// or https:// schemes.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • URLs: all platforms

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

Implementation

static Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) =>
    PlatformChromeSafariBrowser.static().prewarmConnections(URLs);