WebView url listener

flutter_webview_plugin: ^0.3.10+1

untuk listener url pada webview

@override
void initState() {
  StreamSubscription<String> _onWebViewUrlChanged;
  _onWebViewUrlChanged =
      FlutterWebviewPlugin().onUrlChanged.listen((String url) {
    print(url);
    if (url == 'https://lpmpjambi.id/supervisi/auth/login') {
      flutterWebviewPlugin.hide();
      Navigator.pushReplacement(
        context,
        MaterialPageRoute(builder: (context) => LoginPage()),
      );
    }
  });
  super.initState();
}

Last updated