Does notifyListeners() sometimes complete asynchronously?

Posted by Andre Scott | Updated on

Does notifyListeners() sometimes complete asynchronously?

In fact, the notifyListeners() will actually behave asynchronously since it schedules a microtask by using scheduleMicrotask() to call all the registered listeners.

Only comes in mind an ugly solution that might work for your case, which is to run an await Future.delayed(Duration(milliseconds: 300)) just before return true in order to give it a little time to complete its task.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers