Home > Net >  What's the difference between Swift's Dispatchqueue and Flutter's Future?
What's the difference between Swift's Dispatchqueue and Flutter's Future?

Time:09-29

First of all please don't laugh at my question I am still a newbie. Recently I have started learning IOS development and found Dispatchqueue (documentation link: https://developer.apple.com/documentation/dispatch/dispatchqueue). After reading the documentation, I had a question on my mind. Is it similar like Flutter's Future(documentation link: https://api.flutter.dev/flutter/dart-async/Future-class.html)? Or are there any differences between them? If yes, then what are the differences? I was searching the whole internet but I could not find a proper answer which would clear my confusions. Thanks in advance.

CodePudding user response:

DispatchQueue is for parallelization your tasks. It works according to the first in first out principle, means the first tasks will be done first etc. A Future sounds for me like a "delayed" task, means your task will be done in the future but not in the background like in a DispatchQueue. Some good information for DispatchQueue are here Appropriately-using-dispatchqueue-main :-)

  • Related