mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
push autoamtion api connect
This commit is contained in:
17
lib/navigation/navigate_to_route.dart
Normal file
17
lib/navigation/navigate_to_route.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void navigateToRoute(BuildContext context, String targetRoute) {
|
||||
bool routeFound = false;
|
||||
|
||||
Navigator.popUntil(context, (route) {
|
||||
if (route.settings.name == targetRoute) {
|
||||
routeFound = true;
|
||||
return true;
|
||||
}
|
||||
return route.isFirst;
|
||||
});
|
||||
|
||||
if (!routeFound) {
|
||||
Navigator.pushNamed(context, targetRoute);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user