The first reason is readability: sanitizeParams should happen before sendToServer , but it is read in a different order, which should be avoided when working with futures.
A more important reason is that if sanitizeParams throws an exception, then sendParams will not return the future, but will throw it instead, and this makes it difficult for other futures to create it. The second example avoids this by first making the arguments available as Future.value , and then linking other functions to it.
IIRC, this is explained in the screencast.
source share