navigateTo<T> static method

Future<T?>? navigateTo<T>(
  1. String routeName, {
  2. Object? arguments,
})

Navigate to a screen using the stored context

Implementation

static Future<T?>? navigateTo<T>(String routeName, {Object? arguments}) {
  final ctx = context;
  if (ctx == null) {
    DebugLogger.log('[DependencyInjection] ⚠️ Cannot navigate: No context available');
    return null;
  }

  return Navigator.of(ctx).pushNamed<T>(routeName, arguments: arguments);
}