docs: Update mobile development guidelines to enforce safe navigation and typed navigators with fallback mechanisms.
This commit is contained in:
@@ -178,9 +178,11 @@ All backend access is unified through `DataConnectService` with integrated sessi
|
||||
|
||||
- **Zero Direct Imports**: `import 'package:feature_a/...'` is FORBIDDEN inside `package:feature_b`.
|
||||
- Exception: Shared packages like `domain`, `core`, and `design_system` are always accessible.
|
||||
- **Navigation**: Use named routes via Flutter Modular:
|
||||
- **Pattern**: `Modular.to.navigate('route_name')`
|
||||
- **Configuration**: Routes defined in `module.dart` files; constants in `paths.dart`
|
||||
- **Navigation**: Use **Typed Navigators** and **Safe Navigation** via Flutter Modular:
|
||||
- **Safe Methods**: ALWAYS use `safeNavigate()`, `safePush()`, `popSafe()`, and `safePushNamedAndRemoveUntil()` from `NavigationExtensions`.
|
||||
- **Fallback**: All safe methods automatically fall back to the Home page (Staff or Client) if the target route is invalid or the operation fails.
|
||||
- **Typed Navigator Pattern**: Prefer using typed methods on `Modular.to` (e.g., `Modular.to.toShiftDetails(id)`) which are implemented in `ClientNavigator` and `StaffNavigator` using these safe extensions.
|
||||
- **Configuration**: Routes defined in `module.dart` files; constants in `paths.dart`.
|
||||
- **Data Sharing**: Features do not share state directly. Shared data accessed through:
|
||||
- **Domain Repositories**: Centralized data sources (e.g., `AuthRepository`)
|
||||
- **Session Stores**: `StaffSessionStore` and `ClientSessionStore` for app-wide user context
|
||||
|
||||
Reference in New Issue
Block a user