Photo by Arnold Francisca on Unsplash

Use data from Provider during initState() in Flutter.

--

As we all know that Provider is the best known state management package available for flutter application development.

  • initState method called when this object is inserted into the tree.
  • The framework will call this method exactly once for each State object it creates.

You need to use the context to call Provider.of() so you can add addPostFrameCallback() which is called after the first build, there you can use the context

--

--