docs: Update mobile development guidelines to enforce safe navigation and typed navigators with fallback mechanisms.

This commit is contained in:
Achintha Isuru
2026-02-28 17:57:40 -05:00
parent 6902e84519
commit d3f3b0f70e
3 changed files with 13 additions and 8 deletions

View File

@@ -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