fbmobile/lib/core/services/navigation_service.dart
Varakh b55e932204
All checks were successful
continuous-integration/drone/push Build is passing
Added proper linting #noissue
2023-01-04 21:17:54 +01:00

27 lines
886 B
Dart

import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
import '../util/logger.dart';
class NavigationService {
final GlobalKey<NavigatorState> _navigationKey = GlobalKey<NavigatorState>();
GlobalKey<NavigatorState> get navigationKey => _navigationKey;
final Logger logger = getLogger();
void pop() {
logger.d('NavigationService: pop');
_navigationKey.currentState!.pop();
}
Future<dynamic> navigateTo(String routeName, {dynamic arguments}) {
logger.d('NavigationService: navigateTo $routeName');
return _navigationKey.currentState!.pushNamed(routeName, arguments: arguments);
}
Future<dynamic> navigateAndReplaceTo(String routeName, {dynamic arguments}) {
logger.d('NavigationService: navigateAndReplaceTo $routeName');
return _navigationKey.currentState!.pushReplacementNamed(routeName, arguments: arguments);
}
}