Skip to content

Request: Add GetIt.I.replace for simpler testing #241

@esDotDev

Description

@esDotDev

Instead of writing:

if(testing){
    GetIt.I.unregister<BlueToothService>();
    GetIt.I.registerLazySingleton<BlueToothService>(() => BlueToothServiceMock());

    GetIt.I.unregister<PurchasesManager>();
    GetIt.I.registerLazySingleton<PurchasesManager>(() => PurchasesManagerMock());
}

It would be nice to write:

if(testing){
     GetIt.I.replace<BlueToothService>(() => BlueToothServiceMock());
     GetIt.I.replace<PurchasesManager>(() => PurchasesManagerMock());
}

Maybe there is something for this already and I'm just missing it? I tried resetLazySingleton but it didn't work as I expected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions