How to use Injection System - JonathanVegasP/flutter_tools GitHub Wiki
putSingleton: Register an instance globally
putLazy: Register and create the instance globally after first call
putFactory: Register and create the instance on every call
find: Return an instance based on Type
isRegistered: Check if the instance was registered
unRegister: Delete instance if is registered
reset: Delete all registered instances "Most used for tests"
//Get a global instance of injection
final injection = Injection();
//Create a method for register your instances
void initDependencies() {
injection.putLazy<int>(() => 0);
}
//Call where you want!
class Service {
final int counter = injection<int>();
}