openWebViewPage method
Opens a WebView page with the specified URL
context
- BuildContext for navigation
url
- URL to open in WebView
title
- Title for the WebView page
Implementation
Future<Map<String, dynamic>?> openWebViewPage(
BuildContext context, String url, String title) async {
final accessToken = await TokenStorage.getAccessToken();
if (accessToken == null) {
debugPrint(
'[WARNING] For Some reason accessToken got deleted, signing out');
signOut(context);
return {'loggedOut': true};
}
final data = await Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => WebViewPage(url: url, title: title),
),
);
if (data != null &&
data is Map<String, dynamic> &&
data.containsKey('loggedOut') &&
data['loggedOut'] == true) {
signOut(context);
debugPrint('[WARNING] Webviews were logged out: $data');
}
return data;
}