Skip to content
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

Duplicate GlobalKey detected in widget tree #208

Closed
wangjunjx8868 opened this issue May 5, 2023 · 3 comments
Closed

Duplicate GlobalKey detected in widget tree #208

wangjunjx8868 opened this issue May 5, 2023 · 3 comments

Comments

@wangjunjx8868
Copy link

Describe the bug

void addHour(String hour,int index) async{
    Map<String, dynamic>? formData = {
      "id": "1"
    };
    await EasyLoading.show(status: 'Loading...', maskType: EasyLoadingMaskType.black);
    String url="http://www.1111.com";
    Map<String, dynamic>? headers={"Content-type":"application/x-www-form-urlencoded"};
    RequestClient requestClient = RequestClient();
    await requestClient.post(url,data: formData,headers: headers,onError: (e){
      EasyLoading.dismiss();
      EasyLoading.showError(e.message!);
      return e.code==0;
    },onSuccess: (res){
      EasyLoading.dismiss();
      if(res.code==0)
      {
        EasyLoading.showSuccess("ok!");
      }
      else
      {
        EasyLoading.showError(res.message!);
      }
    });
  }

提示错误
Duplicate GlobalKey detected in widget tree.

The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The key was:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.9, on Microsoft Windows [版本 10.0.19045.2846], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.5.3)
[√] Android Studio (version 2022.1)
[√] Connected device (3 available)
[√] HTTP Host Availability

@github-actions
Copy link

github-actions bot commented May 5, 2023

Thanks for taking the time to open an issue. I will have a look and answer as soon as possible.

@kingfariz
Copy link

Are you sure this is because easyloading code? have you tried removing these and temporary using print(""), is the duplicate globalkey still happen?

@wangjunjx8868
Copy link
Author

it's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants