I have an App that login to a specific page and execute some commands via Javascript. But when I start the App again it should open the login form. But, instead, it stays logged and goes to the user's screen.
child: WebView(
initialUrl:
'https://thepage.com/m/customer/account/login/',
onWebViewCreated: (c) {
_webviewController = c;
print("cleaning the cache");
_webviewController.clearCache();
},
onPageFinished: (String page) async {
setState(() {
_isPageLoaded = true;
});
},
javascriptMode: JavascriptMode.unrestricted,
),
I tried to clean the cache, but perhaps it is not enough.
I/zygote64( 5259): Compiler allocated 6MB to compile void android.view.ViewRootImpl.performTraversals()
I/flutter ( 5259): cleaning the cache
I think the problem is that you're not clearing the cookies. I was having the same issue with logging in to a page, and it staying logged in, which I fixed by clearing the cookies in the onWebViewCreated
callback:
onWebViewCreated: (webViewController) {
_controller.complete(webViewController);
webViewController.clearCache();
final cookieManager = CookieManager();
cookieManager.clearCookies();
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With