injectable icon indicating copy to clipboard operation
injectable copied to clipboard

Add an optional parameter "GeItHelper h" to the "$initGetIt" function

Open Hu-Wentao opened this issue 3 years ago • 1 comments

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

Hu-Wentao avatar Aug 09 '20 05:08 Hu-Wentao

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.

LucazzP avatar Aug 12 '20 13:08 LucazzP