findInterfaces<I> abstract method

List<Class<I>> findInterfaces<I>(
  1. Class parentClass, [
  2. bool declared = true
])

Finds all interfaces implemented by the specified class with caching.

{@template class_loader_find_interfaces_as} Parameters:

  • parentClass: The class to find interfaces for
  • declared: Whether to include inherited interfaces (default: true)

Returns:

  • List of implemented interfaces
  • Empty list if no interfaces are implemented
  • Cached results for subsequent calls

Interface Resolution

  • Transitive (default): Includes interfaces from superclasses and mixins
  • Direct only: Only interfaces explicitly declared on this class

Example

final listClass = await loader.loadClass<List>('dart:core/list.dart.List');
final interfaces = await loader.findInterfaces(listClass);
// Returns: [Iterable, Collection, etc.]

// Direct interfaces only
final directInterfaces = await loader.findInterfaces(listClass, false);

Caching Behavior

  • Separate caches for transitive and direct interface queries
  • Cache keys include the transitive flag for proper segregation
  • Automatic cache invalidation on class hierarchy changes {@endtemplate}

Implementation

List<Class<I>> findInterfaces<I>(Class parentClass, [bool declared = true]);