1

I am working on app where I need to show certificate in pdf format inside WebView from specific URL. I am using webview_flutter plugin for webview.

Please consider the below mentioned code:

WebView(
  debuggingEnabled: true,
  initialUrl: Uri.encodeFull('https://docs.google.com/gview?embedded=true&url=${strUrl}'),
  javascriptMode: JavascriptMode.unrestricted,
  onProgress: (int progress) {
    print('WebView is loading (progress : $progress%)');
  },
  onWebViewCreated: (webViewController) {
  _controller.complete(webViewController);
  webViewController.clearCache();
  final cookieManager = CookieManager();
  cookieManager.clearCookies();
  },
),

Now on the progress log if the webview loads certificate properly then the progress shows like 10, 15, 30, 50, 80, 100. But in the case of white screen on no data loading progress went like 10, to directly 100. Logs are not working properly.

I couldn't use other libs or plugin, Is there any solution for same?

Kishan sharma
  • 701
  • 1
  • 6
  • 20

1 Answers1

1

Progress in HTTP isn't an absolute so you cannot always expect a "smooth" progress. Sometimes data chunks will be received in buffers that are outside your control so this behavior isn't surprising.

  • Okay, I got your point. But here in my case I have also tried the same with inappwebview plugin and that's also reverting the same issue. Now with this plugin I am using onLoadError and onLoadHttpError methods but still I didn't receive any error logs there. Is there any way to get the exact error or error code there!!?? So that I can put reload webview function!!?? – Kishan sharma Mar 09 '22 at 10:02