-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get current_url on url change while browsing in webview #381
Comments
Thanks for reporting, that might be a bug then. Currently I'm doing oauth2 with plugin like this: class PayPalLoginWebView extends StatefulWidget {
@override
PayPalLoginWebViewState createState() {
return PayPalLoginWebViewState();
}
}
class PayPalLoginWebViewState extends State<PayPalLoginWebView> {
final flutterWebViewPlugin = FlutterWebviewPlugin();
final payPalLoginUrl = 'paypal-link';
@override
void initState() {
super.initState();
flutterWebViewPlugin.onUrlChanged.listen((String url) {
if (url.contains('/paypal-redirect?')) {
String token = url.substring(
url.indexOf('code=') + 5,
url.indexOf('&'),
);
flutterWebViewPlugin.close();
Navigator.of(context).pop(token);
}
});
}
@override
void dispose() {
flutterWebViewPlugin.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
padding: EdgeInsets.only(top: 8.0),
child: WebviewScaffold(
url: payPalLoginUrl,
withZoom: true,
withLocalStorage: true,
hidden: true,
),
);
}
} |
@charafau did you managed to find any solution ? |
I was calling |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to get current URL if a user browses site within webview. Is there a method already exist, can anyone help?
BTW I have already tried
onUrlChanged.listen
Stream but it only returns url on start or if I trigger reload.The text was updated successfully, but these errors were encountered: