service_runner 1.0.0
service_runner: ^1.0.0 copied to clipboard
A lightweight Flutter package for service initialization with lifecycle management, splash screen support, and a global service registry.
1.0.0 #
Initial release.
Features #
- Service lifecycle management with four phases:
onInit(),onReady(),onAppReady(), andonDispose() - Splash screen support - display a widget while services initialize
- Global service registry - access services anywhere with
service<T>()andserviceOrNull<T>() - Async factory pattern - services can use
static Future<T> init()for async initialization - Explicit type registration - use
Runnable.add<T>()to register by interface type - Lifecycle callbacks -
onBeforeInitandonAfterInithooks inServiceRunner.init() - Error handling -
ServiceInitializationExceptionwith service name, phase, and original error - State tracking -
ServiceRunner.isInitializedandServiceRunner.isInitializingproperties - Concurrent initialization protection - throws if
init()is called while already initializing