Can somebody please explain How is whenCompleted() different from then() in Future with example?
Can somebody please explain How is whenCompleted() different from then() in Future with example?
Based on my understanding:
WhenCompleted: This is called before then (Immediately the future completes). You can use this function if you do not need the value returned by the future, but you have to do something after the future is completed. It can also return an error.
Then: You can use this if you need to access the value of the future and do something after the future function is executed. It can aslo return an error.
These are the only differences I could point out.