title: Null check operator used on a null value when using Named routes
body: <p>I am getting this error after I switched to <code>named routes</code> where my app was working properly when using <code>MaterialPageRoute</code>:</p>
  <p><strong>main.dart:</strong></p>
  <pre><code>void main() {
    WidgetsFlutterBinding.ensureInitialized();
    runApp(
      MultiProvider(
        providers: [
          ChangeNotifierProvider(create: (context) =&gt; ClassA()),
          ChangeNotifierProvider(
              create: (context) =&gt; ClassB()),
        ],
        child: MyApp(),
      ),
    );
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return FutureBuilder(
          future: Firebase.initializeApp(),
          builder: (context, snapshot) {
            if (snapshot.hasError) {
              return ...
            }
            if (snapshot.connectionState == ConnectionState.done) {
                return MaterialApp(
                  debugShowCheckedModeBanner: false,
                  title: 'App Title',
                  initialRoute: '/',
                  routes: {
                    '/': (context) =&gt; Wrapper(),
                    'somePage/': (context) =&gt; SomePage(),
                  },
                );
            }
            //else ...
            return ... ;
          });
    }
  }
  </code></pre>
  <p><strong>The error message:</strong></p>
  <pre><code>The following _CastError was thrown building Builder(dirty):
  Null check operator used on a null value
  
  The relevant error-causing widget was: 
  MaterialApp file:///.../lib/main.dart:40:20
  When the exception was thrown, this was the stack: 
  #0      _WidgetsAppState._onGenerateRoute.&lt;anonymous closure&gt; (package:flutter/src/widgets/app.dart:1196:48)
  #1      MaterialPageRoute.buildContent (package:flutter/src/material/page.dart:54:55)
  #2      MaterialRouteTransitionMixin.buildPage (package:flutter/src/material/page.dart:107:27)
  #3      _ModalScopeState.build.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter/src/widgets/routes.dart:840:53)
  #4      Builder.build (package:flutter/src/widgets/basic.dart:7555:48)
  </code></pre>
  <p><strong>Flutter Doctor:</strong></p>
  <pre><code>Doctor summary (to see all details, run flutter doctor -v):
  [√] Flutter (Channel stable, 2.0.2, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
  [√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
  [√] Chrome - develop for the web
  [√] Android Studio (version 4.1.0)
  [√] VS Code (version 1.52.1)
  [√] Connected device (3 available)
  
  • No issues found!
  </code></pre>
  <p>The weird thing is that the app works after multiple hot-restarts, then a hot-restart crash it.</p>