I have a svreen in my flutter app that basically shows the last 10 or so tweets for a Twitter page using Twitter API. The best package I could have found for this is tweetwebview however, that package hadn't been updated in sometime, so I used the code on the package's github and wrote the class to fit my needs. This is a snippet of that class using the WebView Controller to display the tweets.
```
@override
Widget build(BuildContext context) {
var child;
if (_tweetHTML != '' && _tweetHTML.length > 0) {
final downloadUrl = Uri.file(_filename).toString();
print(downloadUrl);
// Create the WebView to contian the tweet HTML
final webView = WebView(
initialUrl: downloadUrl,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController webViewController) async {
// finally signal a complete() to the completer
_controller.complete(webViewController);
},
navigationDelegate: (NavigationRequest request) {
if (request.url.startsWith(downloadUrl)) {
//print('allowing navigation to $request');
return NavigationDecision.navigate;
}
else if (request.isForMainFrame) {
//print('allowing navigation to $request');
_launchURL(request.url);
return NavigationDecision.prevent;
}
else {
//print('blocking navigation to $request}');
return NavigationDecision.prevent;
}
},);
// The WebView creates an exception: RenderAndroidView object was given an infinite size during layout.
// To avoid that exception a max height constraint will be used. Hopefully soon the WebView will be able
// to size itself so it will not have an infinite height.
final box = LimitedBox(
maxHeight: 500.0,
child: webView,
);
child = box;
} else {
child = Text('Loading...');
}
return Container(child: child);
}
```
final downloadUrl = Uri.file(_filename).toString(); which is what is passed to the WebView Controller, returns something like this:
file:///data/user/0/com.example.BWS_App/cache/tweet-1437153242656428034.html
As far as I understand, this uses the API to download to tweet as an html file. In Android this loads fine but on iOS it only loads as text:


In the class. If say I take the downloadUrl and put in a regular link like say downloadUrl = 'https://www.google.com/' it loads the google page in the WebView perfectly, on both devices. If I use the tweetUrl which would return something like 'https://twitter.com/BelizeWater/status/1437403053875945477' it opens the tweets in an external browser on the phone, on both devices.
So what I want is that iOS loads the file in the same way as Android.