findMixinArguments<I> method
Retrieves the type arguments for a specific mixin applied to a class.
Type Parameters:
I
: The mixin type to match.
Parameters:
parentClass
: The class whose mixin arguments should be found.declared
: Whether to include inherited mixins (default:true
).
Returns:
- A list of Class instances representing the type arguments.
Example
final exampleClass = await loader.loadClass<MyClass>('com.example.MyClass');
final mixinArgs = loader.findMixinArguments<SomeMixin>(exampleClass);
Implementation
@override
List<Class> findMixinArguments<I>(Class parentClass, [bool declared = true]) {
_checkClosed();
final clazz = Class<I>();
final cacheKey = "${_buildCacheKey(parentClass)}:${_buildCacheKey(clazz)}:mixinArguments:$declared";
// Check cache first
final cached = _mixinArgumentCache[cacheKey];
if (cached != null) {
_hitCount++;
return List.from(cached);
}
_missCount++;
// Compute classes
final classes = _computeMixinArguments(parentClass, declared, clazz);
// Cache result
_mixinArgumentCache[cacheKey] = classes;
return List.from(classes.toSet().toList());
}