Giter VIP home page Giter VIP logo

Comments (6)

lsaudon avatar lsaudon commented on June 22, 2024 1

Same error on 3.16.0, 3.16.9, 3.19.3 and master for go_router

from flutter.

pankaj-nikam avatar pankaj-nikam commented on June 22, 2024

Its not only valid with go_router, but other types too. Like I am using flow_builder and it rebuilds the page too. I am going back to version 3.16.9 to test if it is still broken.

Edit: Yes, same code works in 3.16.9 but not in 3.19.2.

from flutter.

lsaudon avatar lsaudon commented on June 22, 2024

Its not only valid with go_router, but other types too. Like I am using flow_builder and it rebuilds the page too. I am going back to version 3.16.9 to test if it is still broken.

Edit: Yes, same code works in 3.16.9 but not in 3.19.2.

It's a navigator v2 bug ?

from flutter.

pankaj-nikam avatar pankaj-nikam commented on June 22, 2024

Its not only valid with go_router, but other types too. Like I am using flow_builder and it rebuilds the page too. I am going back to version 3.16.9 to test if it is still broken.
Edit: Yes, same code works in 3.16.9 but not in 3.19.2.

It's a navigator v2 bug ?

I dont think so it is because it is broken even with flow_builder. Try downgrading flutter. It seems to be working in 3.16.9. I didnt test the other versions.

from flutter.

huycozy avatar huycozy commented on June 22, 2024

Hi everyone,
This is working as intended, please see some similar issues filed before: #132049, #138708. The given solution is building a const widget. E.g:

Sample code
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final GoRouter _router = GoRouter(
    routes: <RouteBase>[
      GoRoute(
        path: '/',
        builder: (context, state) {
          return const RootPage();
        },
        routes: [
          GoRoute(
            path: 'a',
            builder: (context, state) {
              return const DetailPage();
            },
          ),
        ],
      ),
    ],
  );

  @override
  Widget build(BuildContext context) => MaterialApp.router(routerConfig: _router);
}

class RootPage extends StatefulWidget {
  const RootPage({super.key});

  @override
  State<RootPage> createState() => _RootPageState();
}

class _RootPageState extends State<RootPage> {
  @override
  Widget build(BuildContext context) {
    print('RootPage build');
    return Scaffold(
      appBar: AppBar(title: const Text('/')),
      body: Center(
        child: Column(
          children: [
            ElevatedButton(
              onPressed: () => GoRouter.of(context).go('/a'),
              child: const Text('go to a'),
            ),
          ],
        ),
      ),
    );
  }
}

class DetailPage extends StatefulWidget {
  const DetailPage({super.key});

  @override
  State<DetailPage> createState() => _DetailPageState();
}

class _DetailPageState extends State<DetailPage> {
  @override
  Widget build(BuildContext context) {
    print('DetailPage build');
    return Scaffold(
      appBar: AppBar(title: const Text('a')),
      body: Center(
        child: Column(
          children: [
            ElevatedButton(
              onPressed: () => GoRouter.of(context).pop(),
              child: const Text('pop'),
            ),
          ],
        ),
      ),
    );
  }
}

from flutter.

github-actions avatar github-actions commented on June 22, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.