Martin Lasek
1 min readMar 19, 2018

--

Hey Damir! Glad you liked it! I eventually haven’t clarified it good enough and have to rethink my phrasing there 😊! When to use map or flatMap is based on what you are going to return within a map function. And we want to return a redirect within that map function and since this is not a future we need use map here. 😊

I like to think of the map functions also in that way:

map is converting the value of Future<value> into whatever I return within the map function. Whereas the flatMap is converting the whole Future<value> into whatever I return within the map function 😊!

At the end not the inside of one of these map functions but the result of my mapping must match my return value of the route if I am returning that result. I hope that makes sense 😊?

--

--

Martin Lasek
Martin Lasek

Written by Martin Lasek

I'm an always optimistic, open minded and knowledge seeking fullstack developer passionate about UI/UX and changing things for the better :)

Responses (1)