How do I access the context for the Provider in the initState
I keep getting the error
flutter: The following assertion was thrown building Builder:
fl
Provider.of<ProductProvider>(context, listen: false).selectedProduct
and ensure there are no NotifyListeners in the initState call.
Try to postpone this call with Future.delayed(...)
Use Simon's AfterLayout
package https://pub.dev/packages/after_layout and call it in the function you need to implement. It will be called after Build()
has been run