tryRegisterServiceInstance<T extends Object> function
Registers a service instance with the locator but only if not already registered.
Implementation
void tryRegisterServiceInstance<T extends Object>(T service, {String? id}) {
if (!hasService<T>(id: id)) {
registerServiceInstance<T>(service, id: id);
}
}