Questions tagged [flutter-routes]

141 questions
16
votes
6 answers

Get.to(MyPage()) - How to remove all previous routes - Flutter GetX

I have a simple Flutter app and I want to remove all previous routes but I want to do with GetX, How to do that? Now it works with Navigator.of(context).pushNamedAndRemoveUntil('/home', (Route route) => false); But I want to know the…
Álvaro Agüero
  • 4,494
  • 1
  • 42
  • 39
7
votes
1 answer

go_router - Is there a way to push twice the same page?

I'm using go_router to build an application that does "dummy" pushes of routes (a bit like Twitter). It is possible to start with a page /a ,push /b, then /c, ... and then push again /a. When a page is pushed twice, an assert fails:…
Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73
7
votes
5 answers

flutter auto route build runner error Route must have either a page or a redirect destination

when i add a new route to router.dart and run the build runner i get the Route must have either a page or a redirect destination Error below is my code in router.drat : @MaterialAutoRouter( replaceInRouteName: 'Page,Route', routes:…
7
votes
1 answer

Flutter Navigator 2.0 Routing via the Navigator()

I am currently trying to build a web app with the new Flutter web beta. The thing is to be able to have a history, handle the forward and back buttons in the browser and be able to handle user inputs into the URL the new Navigator 2.0 API is…
7
votes
0 answers

Flutter Navigation: Bringing previous route on top of stack

In flutter, I've a use case where I want to bring back the same route on top of the screen if its already present, otherwise push a new route. As an example, Current stack : A -> B -> C -> D (top most) If I push B, I just want A -> C -> D -> B. I…
Avi Yadav
  • 103
  • 1
  • 5
6
votes
1 answer

Advantage from static routing to dynamic routing on Flutter

I can see that MaterialApp app can receive routes. 1. Static routing class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( routes: { '/page1': (context) => Page1(title: "Main…
Daniel Gomez Rico
  • 15,026
  • 20
  • 92
  • 162
5
votes
2 answers

Flutter: Autoroute : RouteGuard not working in AutoTabsScaffold

I am trying add auth guard for my AutoTabsScaffold [bottom nav] but it's not working, It's working in other navigation pages but not just inside my landing page [where AutoTabsScaffold| Bottom Nav resides] am I missing something here? using :…
iamnabink
  • 454
  • 9
  • 27
5
votes
1 answer

Flutter web cannot visit url

In flutter web, how can I open certain page via full address? The scenario is: Open a classroom page route like await Navigator.pushNamed(context, "classroom/detail/$id", arguments: {"data": someData}); Classroom page is opened and the address bar…
Taufik Nur Rahmanda
  • 1,862
  • 2
  • 20
  • 36
5
votes
1 answer

Flutter check is page on top of the screen stack

I have a page A that does some tasks for every time interval. I only want to perform these tasks only if page A is active and showing on the screen. If the screen is showing page B, it will NOT perform the tasks. How should I approach this problem?
user1187968
  • 7,154
  • 16
  • 81
  • 152
4
votes
1 answer

GoRouter - Entering the url in the address bar doesn't only create the related page

I'm writing a web flutter application with go_router. Below is a code sample to illustrate how it is architectured (you can also check out this repo). import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; void main() { …
Valentin Vignal
  • 6,151
  • 2
  • 33
  • 73
4
votes
1 answer

Flutter Web Page Routing Issue

I need web app with base url as https://example.com/mojjo-test/index.html#/ I updated my base url as documented in flutter website: https://flutter.dev/docs/development/ui/navigation/url-strategies in index.html As per…
ashutosh
  • 103
  • 9
4
votes
2 answers

How to navigate to screen and remove all screen/route history [sign out functionality]

How can i navigate to a screen and remove all previous routing history so that the user cannot press back and get to the previous screen? In my case I want to push the login screen when a user is logged out, but the navigation history is still there…
Joel Broström
  • 3,530
  • 1
  • 34
  • 61
3
votes
3 answers

How to use context.go() method for ShellRoute in Flutter/GoRouter

I have a login page, and after login homepage basically. The homepage has BottomNavigationBar, like Instagram, and It's obvious that it's not GoRoute, instead of this it's ShellRoute. So, ShellRoute has a key, but it has not path parameter, and…
3
votes
2 answers

GoRouter - Can I push 2 pages at once?

I'm using go_router and I am about to do this in a callback of one of my buttons: EvelatedButton( onPressed: () { GoRouter.of(context) ..push('/page-1') ..push('/page-2'); }, ) This is to push 2 pages in the history at once.…
3
votes
1 answer

How to make go_router, Appbar, and Drawer work together in Flutter?

I'm using the go_router package in Flutter for app routing, but I'm running into issues when I use it alongside the default Flutter Appbar and Drawer widgets. Typical "go" and "push" methods that I'm calling from clicks in the Drawer don't work as…
Doughy
  • 4,115
  • 6
  • 36
  • 39
1
2 3
9 10