.whenComplete
will fire a function either when the Future completes with an error or not, while.then
returns 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).whenCompleted
is the asynchronous equivalent of a “finally” block.