fluttercommunity / fluttercommunity/flutter_webview_plugin
The monitoring function is triggered twice under the same Url
- 主要语言
- Java
- 星标
- 1.5k
- 派生
- 938
- PR 合并指标
- 30 天内没有已合并 PR
描述
## System info
Issue occurs on: Android
Plugin version: 0.3.11
Flutter doctor output:
[✓] Flutter (Channel stable, 1.22.5, on Mac OS X 10.15.3 19D76 darwin-x64, locale
zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
[✓] VS Code (version 1.52.1)
[✓] Connected device (1 available)
• No issues found!
```
paste it here...
```
## Steps to Reproduce
1. ...
```
@override
void initState() {
super.initState();
webviewPlugin.onUrlChanged.listen((url) {
// TODO:相同的地址会执行两次,bug
if (mounted) {
print("url changed: $url");
isLoading = false;
setState(() {});
if (url != null && url.contains("code=")) {
String code = url.split("?")[1].split("=")[1].split("&")[0];
Map params = Map();
params["client_id"] = AppApiConfig.CLIENT_ID;
params["client_secret"] = AppApiConfig.SECRET_KEY;
params["grant_type"] = "authorization_code";
params["redirect_uri"] = AppApiConfig.CALLBACK;
params["code"] = '$code';
params["dataType"] = "json";
NetUtils.post(AppUrls.OAUTH2_TOKEN, params).then((data) async {
Map map = json.decode(data);
// TODO: 处理bug错误
if (map["error"] == "400") {
print("请求出错");
return;
}
if (map != null && map.isNotEmpty) {
await DataUtils.setLoginInfo(map: map);
Navigator.pop(context, AppMsg.SUCCESS);
}
});
}
}
});
}
```
2. ...
3. ...
## Logs

```
2 I/flutter (12981): url changed: http://blog.jackson615.top/?code=7rX7S6&state=
```
```
```
```
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先,使用 webviewPlugin.onUrlChanged 上的 initState 监听器和记录的 callback URL 重现 Android 案例。跟踪监控事件在哪里发出,并验证同一个 URL 产生的是一个 callback 而不是两个;当不再出现重复通知时,该 issue 即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- flutter, java
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100