import 'package:flutter/material.dart'; class Navigation { final String initialRoute = "/"; Navigation._privateConstructor(); static final Navigation instance = Navigation._privateConstructor(); final GlobalKey navigatorKey = GlobalKey(); Future? navigate(String path,{Object? args}) { return navigatorKey.currentState?.pushNamed(path,arguments: args); } Future? navigateAndReplace(String path,{Object? args}) { return navigatorKey.currentState?.pushReplacementNamed(path,arguments: args); } Future? navigateAndRemoveUntil(String path, {Object? args}) { return navigatorKey.currentState?.pushNamedAndRemoveUntil(path,(Route route) => false, arguments: args); } goBack() { return navigatorKey.currentState?.pop(); } }