How do you initState in flutter?

How do you initState in flutter?
Answer
initState method Null safety
  1. In initState, subscribe to the object.
  2. In didUpdateWidget unsubscribe from the old object and subscribe to the new one if the updated widget configuration requires replacing the object.
  3. In dispose, unsubscribe from the object.
 

Tìm kiếm

Back
Top