title: Flutter: How to prevent multiple MaterialApp.router builder calls when opening the keyboard?
body: <p>I could not find an answer to my question, basically all similar situations are related to rebuilding widgets that use MediaQuery (but not in my case). When I tap on the TextField, the keyboard appears, after which the builder inside the MaterialApp.router is called dozens of times. Is it possible to avoid so many builder calls?</p>
  <p>main.dart:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:routemaster/routemaster.dart';
  
  final routes = RouteMap(
    onUnknownRoute: (route) =&gt; const Redirect(&quot;/&quot;),
    routes: {
      '/': (_) =&gt; const MaterialPage(child: FirstPage()),
    },
  );
  
  void main() {
    runApp(const MyApp());
  }
  
  class MyApp extends StatelessWidget {
    const MyApp({super.key});
    @override
    Widget build(BuildContext context) {
      return MaterialApp.router(
        builder: (context, widget) {
          debugPrint(&quot;Info: MaterialApp.router Build&quot;);
          return widget!;
        },
        routeInformationParser: const RoutemasterParser(),
        routerDelegate: RoutemasterDelegate(
          routesBuilder: (context) {
            debugPrint(&quot;Info: Router Build&quot;);
            return routes;
          },
        ),
      );
    }
  }
  
  class FirstPage extends StatelessWidget {
    const FirstPage({Key? key}) : super(key: key);
    @override
    Widget build(BuildContext context) {
      debugPrint(&quot;Info: FirstPage Build&quot;);
      return Scaffold(
        body: Column(
          children: const [
            Padding(
              padding: EdgeInsets.only(top: 200),
              child: TextField(),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p>Console:</p>
  <pre><code>Launching lib/main.dart on iPhone 13-2 in debug mode...
  Running Xcode build...
  Xcode build done.                                           14,4s
  Debug service listening on ws://127.0.0.1:62493/BzKbBCNai2Q=/ws
  Syncing files to device iPhone 13-2...
  flutter: Info: MaterialApp.router Build
  flutter: Info: Router Build
  flutter: Info: FirstPage Build
  flutter: Info: MaterialApp.router Build // opening keyboard
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  flutter: Info: MaterialApp.router Build
  </code></pre>