ifAvailable method

Future<void> ifAvailable(
  1. Consumer<ObjectHolder<T>> consumer
)

Executes consumer if the object is available.

Implementation

Future<void> ifAvailable(Consumer<ObjectHolder<T>> consumer) async {
  final dependency = await getIfAvailable();
  if (dependency != null) {
    consumer.call(dependency);
  }
}