I have something like that:
@injectable
class SettingsBloc {
final Event event;
SettingsBloc(@factoryParam this.event);
}
When I call it from my code, I pass factory param like: getIt<SettingsBloc>(param1: Event())
But when SettingsBloc is something's dependency, call is autogenerated and looks like this: get<SettingsBloc>()
Generated code:
gh.factoryParam<SettingsBloc, Event, dynamic>(
(event, _) => SettingsBloc(event));
gh.factoryParam<HotelsBloc, Event, dynamic>(
(event, _) => HotelsBloc(
event,
get<SettingsBloc>(),
));
So, factory param is not passed, and everything crashes at runtime. How can I fix this?
P.S. Long story short: there should be a way to generate this code:
gh.factoryParam<HotelsBloc, Event, dynamic>(
(event, _) => HotelsBloc(
event,
get<SettingsBloc>(param1: event),
));
Instead of this:
gh.factoryParam<HotelsBloc, Event, dynamic>(
(event, _) => HotelsBloc(
event,
get<SettingsBloc>(),
));