Flutter Riverpod - using read() inside build method
问题 Suppose I want to initialize a text field by using the initialValue: property on a TextFormField , and I need my initial value to come from a provider. I read on the docs that calling read() from inside the build method is considered bad practice, but calling from handlers is fine (like onPressed ). So I'm wondering if its fine to call read from the initialValue property like shown below? 回答1: No, you should use useProvider if you are using hooks, or a ConsumerWidget / Consumer if you are not