Is there a way we can download blob URL? I referred to the answer mentioned in this thread, but it didn't work for me.
Code is almost the same as the reference I mentioned above.
InAppWebView(
initialOptions: options,
initialUrlRequest: URLRequest(
url: Uri.parse("https://someurl..."),
),
onWebViewCreated: (InAppWebViewController controller) {
elmsController.webViewController = controller;
controller.addJavaScriptHandler(
handlerName: 'blobToBase64Handler',
callback: (data) async {
if (data.isNotEmpty) {
print('base64: $data');
final String receivedFileInBase64 = data[0];
final String receivedMimeType = data[1];
final String yourExtension = 'pdf';
createFileFromBase64(
receivedFileInBase64, 'fileName', yourExtension);
}
},
);
},
onReceivedServerTrustAuthRequest: (controller, challenge) async {
return ServerTrustAuthResponse(
action: ServerTrustAuthResponseAction.PROCEED);
},
onDownloadStart: (controller, url) async {
var jsContent = await rootBundle.loadString("assets/base64.js");
await controller.evaluateJavascript(
source: jsContent.replaceAll("blobUrlPlaceholder", url.path));
},
),
options = InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
javaScriptEnabled: true,
mediaPlaybackRequiresUserGesture: false,
useOnDownloadStart: true),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
));
Cannot see any errors too. The file is not downloaded.