I have a mobile flutter app that uses a flutter_inappwebview. In the webview, I have a mapbox-gl script to display a map. When requesting sprites, the script will make a fetch request to "https://content/sprite/sprite@2x.json", which I am able to capture using shouldInterceptFetchRequest. I would like the response to this request to contain a custom json file that I generate in my code.
In native Android, I am familiar with shouldInterceptRequest, which allows me to return a custom web resource response. However, the shouldInterceptFetchRequest in flutter_inappwebview requires me to return a FetchRequest. It seems the intent of shouldOverrideFetchRequest is to change the request before sending it from within the webview. Instead, I would like to create my own response, similar to the native Android method.
How do I supply a custom response to an inappwebview fetch request?