You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to register my scope first before calling $register and passing my custom EnvironmentFilter. But my dependencies annotated with my custom Environment are not registered.
@InjectableInit(
initializerName:r'$register',
preferRelativeImports:false,
asExtension:false,
)
abstractfinalclassServiceLocator {
staticfinalGetIt instance =GetIt.instance..allowReassignment =true;
staticFuture<void> registerDependencies() async {
// We need to register forground services firstinitForegroundServiceScope(instance);
// We need to manually override the pre-registered `EnvironmentFilter` with our new filterfinal environments =await_getEnvironments();
final environmentFilter =NoEnvOrContainsAny(environments);
instance.registerSingleton<EnvironmentFilter>(environmentFilter, instanceName: kEnvironmentsFilterName);
await$register(instance, environmentFilter: environmentFilter);
}
staticFuture<Set<String>> _getEnvironments() async {
// return custom environments based on current config...
}
}
Upon checking, it seems that when registering a scope first, it registers a EnvironmentFilter with a instanceName using kEnvironmentsFilterName from get_it_helper.dart. This overrides the custom EnvironmentFilter I used in my $register. As a workaround I re-register my custom EnvironmentFilter.
Is this the expected behavior?
The text was updated successfully, but these errors were encountered:
I am trying to register my scope first before calling
$register
and passing my customEnvironmentFilter
. But my dependencies annotated with my customEnvironment
are not registered.Upon checking, it seems that when registering a scope first, it registers a
EnvironmentFilter
with ainstanceName
usingkEnvironmentsFilterName
fromget_it_helper.dart
. This overrides the customEnvironmentFilter
I used in my$register
. As a workaround I re-register my customEnvironmentFilter
.Is this the expected behavior?
The text was updated successfully, but these errors were encountered: