mirror of
https://github.com/hmalik144/days_left_flutter.git
synced 2025-12-10 03:05:21 +00:00
- Introduction on base view model and stateless widget classes
- Implementation of firebase - Implementation of dependency injection Took 11 hours 26 minutes
This commit is contained in:
21
lib/services/NavigationService.dart
Normal file
21
lib/services/NavigationService.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class NavigationService {
|
||||
GlobalKey<NavigatorState> _navigationKey = GlobalKey<NavigatorState>();
|
||||
|
||||
GlobalKey<NavigatorState> get navigationKey => _navigationKey;
|
||||
|
||||
void pop() {
|
||||
return _navigationKey.currentState.pop();
|
||||
}
|
||||
|
||||
Future<dynamic> navigateTo(String routeName, {dynamic arguments}) {
|
||||
return _navigationKey.currentState
|
||||
.pushNamed(routeName, arguments: arguments);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToAndClearStack(String routeName, {dynamic arguments}) {
|
||||
return _navigationKey.currentState
|
||||
.pushNamedAndRemoveUntil(routeName, (r) => false, arguments: arguments);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user