retryWithProxy static method

Future<void> retryWithProxy(
  1. String url
)

Static method to load a URL via CORS proxy Can be called from custom buttons stacked over the widget This will mark the URL for proxy usage and trigger a reload

Example usage:

Stack(children: [
  SWebView(url: 'https://example.com'),
  Positioned(
    top: 10,
    right: 10,
    child: PointerInterceptor(
      child: ElevatedButton(
        onPressed: () => SWebView.retryWithProxy('https://example.com'),
        child: Text('Retry with Proxy'),
      ),
    ),
  ),
])

Implementation

static Future<void> retryWithProxy(String url) async {
  if (kDebugMode) {
    debugPrint('SWebView: User requested retry with proxy for $url');
    debugPrint(
        'SWebView: ⚠️ SUGGESTION: Add "${Uri.parse(url).host}" to restrictedDomains list');
  }

  // Mark URL as needing proxy for future loads
  _SWebViewState._restrictionCache[url] = true;
  await _SWebViewState._saveCache();
}