According to the flutter docs, it is stated that:
Generally it is recommended that the setState method only be used to
wrap the actual changes to the state, not any computation that might
be associated with the change.
Mainly I think that it is for readability purposes, i.e, you need to put in the body of setState
what is changing in the new build of the widget, without mixing that with your computations as the first method in your question does.