Milad-Akarie / injectable

Code Generator for get_it
MIT License
566 stars 143 forks source link

Bug: wrong registration order #475

Open ChaserVasya opened 3 months ago

ChaserVasya commented 3 months ago

When I run not dev flavor error is threw.

const String _dev = 'dev';
const String _prod = 'prod';
const String _test = 'test';
const String _odin = 'odin';
...
    gh.factory<_i201.FlavorConfig>(
      () => flavorsModule.devFlavor,
      registerFor: {_dev},
    );
    await gh.singletonAsync<_i743.LocalStorage>(
      () => customInitModule.storage(
        gh<_i201.FlavorConfig>(), // Bad state: GetIt: Object/factory with type FlavorConfig is not registered inside GetIt
        gh<_i460.SharedPreferences>(),
      ),
      preResolve: true,
    );
    gh.factory<_i201.FlavorConfig>(
      () => flavorsModule.testFlavor,
      registerFor: {_test},
    );
    gh.factory<_i201.FlavorConfig>(
      () => flavorsModule.prodFlavor,
      registerFor: {_prod},
    );
    gh.factory<_i201.FlavorConfig>(
      () => flavorsModule.odinFlavor,
      registerFor: {_odin},
    );
...

context

injectable: 2.4.4 injectable_generator: 2.6.2

ghost commented 3 months ago

I'm sorry! I didn't do this!! It seems to be something not good just don't click it my apology!!!

ghost commented 3 months ago

I don't know what it is either!!!

nowrose-ragib commented 2 months ago

Same issue here.