Repository navigation
v2.0.5 - App-Level Service Initialization Support
✨ New Feature: App-Level Service Initialization
This release adds support for coordinating app-level service initialization to prevent SignalEffectException during startup.
The Problem
In v2.0.3, we fixed SignalEffectException in the framework's internal services, but apps with their own services (ChatManager, EventFlowService, etc.) could still experience crashes during initialization when those services created effects while the UI's Watch widgets were activating.
The Solution
New appReady Signal Parameter in AppConfig
The framework now supports an optional appReady signal that allows apps to coordinate initialization of all their services before the main UI renders.
Added
AppConfig Enhancement:
- ✨ New optional
appReady: Signal<bool>?parameter - Framework waits for BOTH
settingsStore.isReadyANDappReadybefore rendering UI - Prevents concurrent reactive initialization issues
- Comprehensive inline documentation with usage example
Files Changed:
lib/src/core/app_config.dart- AddedappReadyparameter with detailed docslib/src/core/app_shell_runner.dart- Extended initialization guard
Usage Example
// 1. Create an appReady signal
final appReady = signal(false);
// 2. Initialize your services and wait for them
Future<void> initializeServices() async {
await chatManager.initialize();
await eventFlowService.initialize();
// Wait for all service isReady signals
await Future.doWhile(() async {
await Future.delayed(Duration(milliseconds: 50));
return !chatManager.isReady.value || !eventFlowService.isReady.value;
});
appReady.value = true;
}
// 3. Pass appReady to AppConfig
void main() async {
await initializeServices();
runShellApp(
appConfig: AppConfig(
appReady: appReady,
routes: routes,
title: 'My App',
),
);
}Migration
For apps experiencing SignalEffectException during initialization:
- Add
isReadysignals to your app services (following the pattern from v2.0.3) - Create an
appReadysignal - Wait for all service
isReadysignals before settingappReady.value = true - Pass
appReadytoAppConfig
No migration required for apps not experiencing initialization issues.
Documentation
- 📚 Detailed usage example in
AppConfigdocumentation - 📚 Migration guide in CHANGELOG.md
- 📚 Updated CLAUDE.md with v2.0.5 notes
Technical Details
This solves the concurrent reactive initialization problem:
- Before: App services created effects → Watch widgets activated simultaneously → SignalEffectException
- After: Framework waits for
appReady→ All services stable → Watch widgets activate safely
Full Changelog: v2.0.4...v2.0.5