autoDetectNavigationSystem method

Future<void> autoDetectNavigationSystem({
  1. dynamic routerDelegate,
})

Auto-detect navigation system and switch provider

Implementation

Future<void> autoDetectNavigationSystem({dynamic routerDelegate}) async {
  if (!_isActive) return;

  try {
    // If RouterDelegate is provided, assume GoRouter
    if (routerDelegate != null) {
      await switchToGoRouter(routerDelegate,
          caller: 'AUTO_DETECT_NAVIGATION_SYSTEM');
      return;
    }

    // Try to detect GoRouter by checking for go_router package
    // This is a simple heuristic - in practice, the app should call switchToGoRouter explicitly
    ObslyLogger.debug('Using default FlutterNavigator provider');
  } catch (e) {
    ObslyLogger.error('Error in auto-detection: $e');
  }
}