Hi @pintiboy! So yes, futures are confusing, but it does eventually make sense. The highlighted line is correct as written. The reason is that the closure for that
flatMap will return
Future<HTTPStatus>. That happens because the
map inside the
Future<HTTPStatus> because the closure for that one returns
HTTPStatus (remember if it’s a map, you return a non-future inside the closure and that gets turned into a future. If it’s
flatMap you return a future inside the closure and that’s the return type).
When chaining, things are slightly different. In the chaining example, the
Future<User> because you’re returning the result of the save, which is the future user. The
Future<User> is then passed into the
map which returns
HTTPStatus. Because they’re chained, the last result of the chain is the eventual return type for that block, again
Future<HTTPStatus>. Does that make sense?