static T add<T>(T object, FutureOr onClose(T object)) => ServiceRegistry.defaultInstance.register(object, onClose);