I am trying to set all dependencies using Provider and not using get_it or other kind of instantiation in initState
return MultiProvider(
providers: [
Provider<UserRepository>.value(value: FbUserRepository()),
ChangeNotifierProvider<AppModel>(builder: (context) => AppModel()),
ChangeNotifierProvider<AuthModel>(builder: (context) => AuthModel()),
ProxyProvider3<UserRepository, AuthModel, AppModel, AppController>(
updateShouldNotify: (_, __) => false,
initialBuilder: (_) => AppController(),
builder: (_, repo, authModel, appModel, app) => app..model = appModel ..userRepository = repo,
), ],
The AppController(or any other viewModel used in some section of the app) has methods that will change the AppModel. Changes in AppModel will reflect in different places on the app.
How I can call some start()/init() method on AppController when on all the dependencies are set? (I cant use the AppController constructor to pass the dependencies, as they(the dependencies) are not passed on initialBuilder).