Seitennavigation mit Flutter 

import ‚package:flutter/material.dart‘; 

void main() { 
  runApp( 
    MaterialApp( 
      title: ‚Beispiel für Named Routes‘, 
      // Start mit „/“ als named route.
      initialRoute: ‚/one‘, 
      routes: { 
        // „/one“ route, erstellt das PageOne widget. 
        ‚/‘: (context) => const PageOne(), 
        // „/two“ route, ruft das PageTwo widget auf. 
        ‚/two‘: (context) => const PageTwo(), 
      }, 
    ),   ); 


class PageOne extends StatelessWidget { 
  const PageOne({super.key}); 

  @override 
  Widget build(BuildContext context) { 
    return Scaffold( 
      appBar: AppBar( 
        title: const Text(‚Erste App Seite‘), 
      ), 
      body: Center( 
        child: ElevatedButton( 
             onPressed: () { 
            //springe zur 2. Seite der named routes. 
            Navigator.pushNamed(context, ‚/two‘); 
          }, 
          child: const Text(‚Aufruf Seite 2‘), 
        ), 
      ), 
    ); 
  } 

class PageTwo extends StatelessWidget { 
  const PageTwo({super.key}); 

  @override 
  Widget build(BuildContext context) { 
    return Scaffold( 
      appBar: AppBar( 
        title: const Text(‚Zweite App Seite‘), 
      ), 
      body: Center( 
        child: ElevatedButton( 
               onPressed: () { 
            //Rücksprung zur ersten Seite per pop
            Navigator.pop(context); 
          }, 
          child: const Text(‚zurück‘), 
        ),      ),      ); 

} }