Files
MessagingApp/lib/service/navigation_service.dart
onasanya.lanre 7e33872886 Pages Implementation
Implemented Profile and Recent Conversation skeleton pages
2025-02-07 20:13:07 +00:00

30 lines
730 B
Dart

import 'package:flutter/material.dart';
class NavigationService {
//
static NavigationService instance = NavigationService();
GlobalKey<NavigatorState>? navigatorKey;
NavigationService() {
navigatorKey = GlobalKey<NavigatorState>();
}
Future<dynamic>? navigateToReplacement(String _routeName) {
return navigatorKey!.currentState!.pushReplacementNamed(_routeName);
}
Future<dynamic>? navigateTo(String _routeName) {
return navigatorKey!.currentState!.pushNamed(_routeName);
}
Future<dynamic>? navigateToRoute(MaterialPageRoute _route) {
return navigatorKey!.currentState!.push(_route);
}
// Manually Call Function
void goBack() {
return navigatorKey!.currentState!.pop();
}
}