Use get_it package as locator for manage instances.
class DependencyLocator {
/// create a global instance with [GetIt]
static void putLazyInstance<T extends Object>(T Function() instance, {String? instanceName})
/// create a global instance with [GetIt] in async way
static void putLazyInstanceAsync<T extends Object>(Future<T> Function() instance, {String? instanceName})
/// get the global instance from [GetIt]
static T findInstance<T extends Object>({Type? type, String? instanceName})
/// remove instance instance from [GetIt]
static Future<void> destroyInstance<T extends Object>({T? instance, String? instanceName})
/// check if instance already registered with [GetIt]
static bool isRegistered<T extends Object>({T? instance, String? instanceName})
/// if instance [isRegistered] => return the Registered instance
///
/// if instance is not registered => return "null"
static T? findInstanceOrNull<T extends Object>({Type? type, String? instanceName})
/// if instance [isRegistered] => return the Registered instance
///
/// if instance is not registered => return [instance] with ability to register it
static T tryFindInstance<T extends Object>(
T instance, {
bool register = false,
Type? type,
String? instanceName,
})
}