Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

hide method error #7

Closed
fg2q1q3q opened this issue Apr 25, 2019 · 6 comments
Closed

hide method error #7

fg2q1q3q opened this issue Apr 25, 2019 · 6 comments
Assignees
Labels
bug Something isn't working fixed fixed in latest update

Comments

@fg2q1q3q
Copy link

fg2q1q3q commented Apr 25, 2019

I encountered the problem of hide () method error reporting in the process of using it.
My code like this:

           pr.show();
           UserDao.login( _userName,_password).then((res) {
              pr.hide();
              if (res != null) {
                LocalStorage.save(Config.USER_NAME_KEY, _userName);
                LocalStorage.save(Config.PW_KEY, _password);
                NavigatorUtils.goHome(context);
             }
          });

But the error is as follows

E/flutter (32311): At this point the state of the widget's element tree is no longer stable. To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.
@fayaz07
Copy link
Owner

fayaz07 commented Apr 25, 2019

please check if the progress dialog is in showing state or hidden state

if(pr.isShowing())
  pr.hide();

@fayaz07 fayaz07 self-assigned this Apr 25, 2019
@fayaz07 fayaz07 added the waiting for response waiting for the customer to respond with the updated code/comment label Apr 25, 2019
@fg2q1q3q
Copy link
Author

fg2q1q3q commented Apr 26, 2019

First of all, the above suggestions didn't help, and I found that isShowing is always false by printing logs and viewing source code.

Now I have found the reason for the problem, because every network request I will first determine whether the network is available, if not cancel the request, because this is not a time-consuming operation, which led to the error, you can reproduce this error with the following code:

           pr.show();
           Future.delayed(Duration(seconds: 0)).then((onValue){
              print("pr show? ${pr.isShowing()}");
              pr.hide();
             }
           );

1.Whether seconds is 0 or 5, isshowing is false forever, which is a bug.
2.When seconds is 5, it is normal, but when seconds is 0, it will report an error. It is suggested to add a rendering completion identifier, cancel the rendering if no rendering is completed when calling hide, and call isShowing in hide for judgment.

@fayaz07
Copy link
Owner

fayaz07 commented Apr 26, 2019

@fg2q1q3q I have got the bug, acutally the isShowing is remaining unchanged on any operation, thanks for reporting. I have fixed the issue, soon I will update the library soon :)

@fayaz07 fayaz07 added bug Something isn't working fixed fixed in latest update and removed waiting for response waiting for the customer to respond with the updated code/comment labels Apr 26, 2019
@fayaz07 fayaz07 closed this as completed Apr 30, 2019
@fayaz07
Copy link
Owner

fayaz07 commented Apr 30, 2019

fixed in the latest version progress_dialog: ^1.1.0+1

@fg2q1q3q
Copy link
Author

fg2q1q3q commented May 6, 2019

Thank you. I've tried. Everything's OK.

@fayaz07
Copy link
Owner

fayaz07 commented May 7, 2019

@fg2q1q3q :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working fixed fixed in latest update
Projects
None yet
Development

No branches or pull requests

2 participants