.whenCompletewill fire a function either when the Future completes with an error or not, while.thenreturns a new Future which is completed with the result of the call toonValue(if this future completes with a value) or toonError(if this future completes with an error).whenCompletedis the asynchronous equivalent of a “finally” block.