import 'package:flutter/material.dart';

class NavigationService {
  static final GlobalKey<NavigatorState> navigatorKey =
      GlobalKey<NavigatorState>();

  static Future<dynamic> push(String route, {Object? arguments}) {
    return navigatorKey.currentState!
        .pushNamed(route, arguments: arguments);
  }

  static Future<dynamic> pushReplace(String route, {Object? arguments}) {
    return navigatorKey.currentState!
        .pushReplacementNamed(route, arguments: arguments);
  }

  static Future<dynamic> pushRemove(String route, {Object? arguments}) {
    return navigatorKey.currentState!.pushNamedAndRemoveUntil(
      route,
      (route) => false,
      arguments: arguments,
    );
  }

  static void pop() {
    return navigatorKey.currentState!.pop();
  }
}
