isRiverpodRef function

bool isRiverpodRef(
  1. DartType targetType
)

Implementation

bool isRiverpodRef(DartType targetType) {
  final isBuiltInRef = _isBuiltInRef(targetType);
  if (isBuiltInRef) return true;

  final targetElement = targetType.element;

  // Not a built-in ref. Might be a generated ref, let's check that.
  if (targetElement is! MixinElement) return false;
  final constraints = targetElement.superclassConstraints.singleOrNull;
  if (constraints == null) return false;

  return _isBuiltInRef(constraints);
}