mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-11 07:37:48 +00:00
18 lines
377 B
Dart
18 lines
377 B
Dart
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);
|
|
}
|
|
}
|