PodProviderNotInitializedException constructor
PodProviderNotInitializedException()
Create a new PodProviderNotInitializedException with the default message.
Exception thrown when attempting to use a PodProvider that hasn't been fully initialized.
Factory pods go through an initialization process before they can produce other pods. This exception occurs when code tries to access the factory pod's product before the factory itself is ready.
Example:
class MyPodProvider implements PodProvider<MyService> {
bool _initialized = false;
@override
MyService getObject() {
if (!_initialized) {
throw PodProviderNotInitializedException();
}
return MyService();
}
}
// Usage
try {
final service = factoryPod.getObject();
} catch (e) {
if (e is PodProviderNotInitializedException) {
print('Factory pod not ready yet');
}
}
Implementation
PodProviderNotInitializedException()
: super("PodProvider has not completed initialization and cannot produce objects yet");