isLoaded method
Checks if a class is already loaded in the cache.
Parameters:
className
: The fully qualified class name to check
Returns:
true
if the class is currently cachedfalse
if the class needs to be loaded
Use Cases
- Avoiding unnecessary loading operations
- Cache hit rate monitoring
- Conditional loading strategies
Example
if (!loader.isLoaded('com.example.User')) {
print('Loading User class for first time...');
await loader.loadClass<User>('com.example.User');
}
Performance
- O(1) lookup operation
- No I/O or reflection overhead
- Safe for frequent checking
Implementation
@override
bool isLoaded(String className) {
return _classCache.containsKey(className);
}