injectable
injectable copied to clipboard
Add an optional parameter "GeItHelper h" to the "$initGetIt" function
before:
GetIt $initGetIt(
GetIt get, {
String environment,
EnvironmentFilter environmentFilter,
}) {
final gh = GetItHelper(get, environment, environmentFilter);
...
after
GetIt $initGetIt(
GetIt get, {
String environment,
EnvironmentFilter environmentFilter,
GetItHelper h,
}) {
final gh = h ?? GetItHelper(get, environment, environmentFilter);
...
This is useful in some cases
Other thing to change is the return, to GetItHelper
, instead of GetIt
, with this we can use this parameter as you suggested.
In my case, I'm using a core package that initializes the core of the app, but in my app, I use again the injectable and is needed to initialize again, because the GetItHelper
had been initialized, the launch is blocked.
So, with this solution, I fixed my problem.