The golden rule in ANY language is:
- It is a property? You can use it wherever you want *
- It is a function? Cache it (i.e.:
final theme = Theme.of(context)in the beginning ofbuildmethod)
*: There are some cases where there are violations about this rule, and even Google break it (example: Beware of Color.value's performance)