I have provider object (mobx store) in builder function. I want to monitor that. Right now in store constructor I have autorun wired up. Is doing inside widget possible?
Thx
If you have a StatefulWidget, you could do in the initState(). Make sure to also dispose in the dispose()
@pavanpodila Thx for getting back, but can I get store from provider in initState?
Only way I guess right now might be with binding after layout render. https://pub.dev/packages/after_layout
Ah yes, I forgot about that. @rrousselGit can we pull a Store from Provider inside initState?
Provider(
builder: (_) => MyStore(),
dispose: (_, store) => store.dispose(),
)
As for obtaining the store inside initState you can do:
initState() {
Provider.of<MyStore>(context, listen: false);
}
Thx a bunch guys!! really helpful.
Most helpful comment
As for obtaining the store inside
initStateyou can do: