fluttercommunity / fluttercommunity/flutter_webview_plugin

onUrlChanged always listen even I cancel the subscription & dispose the webview

オープン
#809 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
1.5k
フォーク
938
PR マージ指標
30日以内にマージされた PR はありません

説明

I noticed that whenever I click the webview for the 2nd time . onUrlChanged listen ( duplicate ) the same data .

[✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.2 19C57,
locale en-MY)
• Flutter version 1.17.5 at /Users/Users/flutter
• Framework revision 8af6b2f038 (7 weeks ago), 2020-06-30
12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK
version 30.0.1)
• Android SDK at /Users/Users/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.8.4

[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android
Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.13.2

`final flutterWebViewPlugin = FlutterWebviewPlugin();
StreamSubscription _onUrlChanged;

@override
void initState() {
super.initState();
flutterWebViewPlugin.close();
_onUrlChanged = flutterWebViewPlugin.onUrlChanged.listen((url) {
if (mounted) {
if (url.contains(
'${EnviromentConfig.baseUrl}/?status_id=1')) {
Uri uri = Uri.parse(url);
_redirect(uri);
} else if (url.contains(
'${EnviromentConfig.baseUrl}/?status_id=0')) {
Uri uri = Uri.parse(url);
String message = uri.queryParameters['message'].replaceAll('_', ' ');
Navigator.pop(_scaffoldKey.currentContext);
final snackBar =
SnackBar(backgroundColor: Colors.red, content: Text(message));
_scaffoldKey.currentState.showSnackBar(snackBar);
}
}
});
}

@override
void dispose() {
_onUrlChanged.cancel();
flutterWebViewPlugin.dispose();
super.dispose();
}`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start with the onUrlChanged subscription and the dispose lifecycle shown in the report, then reproduce the second webview interaction using the supplied example. Trace whether cancellation and webview disposal stop callbacks; done means a later webview interaction does not deliver duplicate URL-change events.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
dart, flutter
領域
mobile-dev
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。