Open jaggerwang opened 6 years ago
And when I call getCookies
, I got the following error.
print(FlutterWebviewPlugin().getCookies());
Runner: flutter: Instance of 'Future<Map<String, dynamic>>'
Runner: [VERBOSE-2:dart_error.cc(16)] Unhandled exception:
type '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'FutureOr<Map<String, dynamic>>'
#0 FlutterWebviewPlugin.getCookies (package:flutter_webview_plugin/src/base.dart:155:12)
<asynchronous suspension>
#1 _TumblrLoginScreenState.initCookie (file:///Users/jagger/projects/tangbole/app/lib/components/account/tumblr_login.dart:37:42)
<asynchronous suspension>
#2 _TumblrLoginScreenState.initState (file:///Users/jagger/projects/tangbole/app/lib/components/account/tumblr_login.dart:24:5)
#3 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3751:58)
#4 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3617:5)
#5 Element.inflateWidget (package:flutter/src/widgets/framework.dart:2907:14)
#6 Element.updateChild (package:flutter/src/widgets/framework.dart:2710:12)
#7 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:4654:14)
#8 El<…>
And It can't load local url http://localhost:8080/account/info
with withLocalUrl: true
, the local url can be open in safari in iOS simulator. But it can load none local url https://tangbole.app/api/account/info
. Does it because I'm not using https in local url?
Anyone here?
You should use 127.0.0.1 not localhost for local url
Problem
I see there is a
getCookies
method, but I want to set cookie to webview, so webview and app can share the same session.I tried the following method, but not working.
I tried the JavaScript code in Chrome, it did work.
Env