You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
832 B
Dart
26 lines
832 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class NavigationService {
|
|
final GlobalKey<NavigatorState> navigatorKey =
|
|
new GlobalKey<NavigatorState>();
|
|
Future<dynamic> navigateTo(String routeName,{Object arguments}) {
|
|
return navigatorKey.currentState.pushNamed(routeName,arguments: arguments);
|
|
}
|
|
|
|
Future<dynamic> pushReplacementNamed(String routeName,{Object arguments}) {
|
|
return navigatorKey.currentState.pushReplacementNamed(routeName,arguments: arguments);
|
|
}
|
|
|
|
|
|
Future<dynamic> pushNamedAndRemoveUntil(String routeName) {
|
|
return navigatorKey.currentState.pushNamedAndRemoveUntil(routeName,(asd)=>false);
|
|
}
|
|
|
|
Future<dynamic> pushAndRemoveUntil(Route newRoute) {
|
|
return navigatorKey.currentState.pushAndRemoveUntil(newRoute,(asd)=>false);
|
|
}
|
|
|
|
pop() {
|
|
return navigatorKey.currentState.pop();
|
|
}
|
|
} |