getPossibleTypes method

List<ObjectTypeDefinition> getPossibleTypes(
  1. AbstractType? abstractType
)

Get the possible ObjectTypeDefinitions that the given abstractType could be resolved into

Implementation

List<ObjectTypeDefinition> getPossibleTypes(AbstractType? abstractType) {
  if (abstractType is UnionTypeDefinition) {
    return abstractType.types;
  }
  if (abstractType is InterfaceTypeDefinition) {
    return objectTypes.where(abstractType.isImplementedBy).toList();
  }
  throw ArgumentError("$abstractType is unsupported");
}