getServiceSingletonWithParamsSyncOrNull<T extends Service<P>, P extends Object?> method

T? getServiceSingletonWithParamsSyncOrNull<T extends Service<P>, P extends Object?>({
  1. required P params,
  2. Entity<Object>? groupEntity,
  3. bool traverse = true,
  4. bool throwIfAsync = false,
})
inherited

Implementation

T? getServiceSingletonWithParamsSyncOrNull<T extends Service<P>,
    P extends Object?>({
  required P params,
  Entity? groupEntity,
  bool traverse = true,
  bool throwIfAsync = false,
}) {
  final value = getServiceSingletonWithParamsOrNull<T, P>(
    params: params,
    groupEntity: groupEntity,
    traverse: traverse,
  );
  if (throwIfAsync && value is Future) {
    throw DependencyIsFutureException(
      type: T,
      groupEntity: groupEntity,
    );
  }
  return value?.asSyncOrNull;
}