getSyncOrNull<T extends Object> method

T? getSyncOrNull<T extends Object>({
  1. Entity<Object>? groupEntity,
  2. bool traverse = true,
  3. bool throwIfAsync = false,
})
inherited

Implementation

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