clearCache static method

void clearCache()

Clears the internal ResolvableType cache.

This method clears the internal cache used by ResolvableType to store previously created instances. This can be useful for memory management in long-running applications or when you need to ensure fresh type resolution.

Example:

// Create some types (they get cached)
final type1 = ResolvableType.forClass(String);
final type2 = ResolvableType.forClass(List<int>);

// Clear the cache to free memory
ResolvableType.clearCache();

// Subsequent type creation will not use cached instances
final type3 = ResolvableType.forClass(String); // New instance, not cached

// Useful for memory management
void cleanupTypeSystem() {
  ResolvableType.clearCache();
}

Implementation

static void clearCache() {
  _cache.clear();
}