Hyder Hussain
unread,Apr 22, 2021, 12:12:20 PM4/22/21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Flutter Development (flutter-dev)
Hey.
Can anyone tell me how to pass local storage to webview in Flutter? I have searched online and couldn’t find much. Following is the error I get when trying to pass local storage. I am not sure if this is the right way to do so?
```
body: WebView(
initialUrl: _url,
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (controller) async { await cookieManager.setCookies([
Cookie(cookieName, cookieValue)
..domain = domain
..expires = DateTime.now().add(Duration(days: 10))
..httpOnly = false,
Cookie(cookieName2, cookieValue2)
..domain = domain
..expires = DateTime.now().add(Duration(days: 10))
..httpOnly = false,
Cookie(cookieName3, cookieValue3)
..domain = domain
..expires = DateTime.now().add(Duration(days: 10))
..httpOnly = false
]);
await controller.evaluate javascript(
'localStorage["tenant_auth_setting"] = $localStorageCookie2');
```
A screenshot of the error is attached:
Screenshot 2021-04-22 at 9.41.35 PM.png