parseProvider method

ProviderElement parseProvider(
  1. DartObject o
)

Parses a static object representing a Provider.

Implementation

ProviderElement parseProvider(DartObject o) {
  if (isType(o)) {
    // Represents "Foo", which is legacy short-hand for "ClassProvider(Foo)".
    return _parseTypeAsImplicitClassProvider(o);
  }
  if (!isProvider(o)) {
    final typeName = getTypeName(o.type!);
    throw FormatException('Expected Provider, got "$typeName".');
  }
  return _parseProvider(o);
}