save before flutter upgrade
This commit is contained in:
18
lib/services/navigation_service.dart
Normal file
18
lib/services/navigation_service.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavigationService {
|
||||
static GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
static navigateTo(String routeName) async {
|
||||
return await navigatorKey.currentState!.pushNamed(routeName);
|
||||
}
|
||||
|
||||
static replaceTo(String routeName) async {
|
||||
return await navigatorKey.currentState!.pushReplacementNamed(routeName);
|
||||
}
|
||||
|
||||
static removeTo(String newRoute) async {
|
||||
return await navigatorKey.currentState!
|
||||
.pushNamedAndRemoveUntil(newRoute, (_) => false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user