In the context of an Android development using Cloud Firestore database, I am writing the method get(int id) : MyDO
of my DAO class. Since, in Firestore, all the operations are asynchronous, the use of the return, a MyDO
object, must take account of this asynchronous aspect.
A first solution would be the callback. The method get
I'm writting could accepts a callback parameter (as a second parameter) in which I would put the code, in the call to get
, that uses the object MyDO
. However, I don't want it.
I know a bit about promises, or even await/async
. Would these notions be useful in this context?