Router Pass Argument In Flutter

Router Pass Argument In Flutter :

class Router {
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch ( {
      case '/':
        return MaterialPageRoute(builder: (_) => ListAnnotationPage());
      case '/newAnotation':
        return MaterialPageRoute(builder: (_) => CreatedAnnotationPage());
      case '/openAnnotation':
        //TODO PASS DATA
        var annotation = settings.arguments as Annotation;
        return MaterialPageRoute(builder: (_) => CreatedAnnotationPage(anotation: annotation));
        class Annotation {
              final int id_anotation;
              String title; }   
        Navigator.pushNamed(context, '/openAnnotation', arguments: anotation);
      case '/searchPage':
        return MaterialPageRoute(builder: (_) => SearchAnnotationPage());
        return MaterialPageRoute(builder: (_) => ListAnnotationPage());

initialRoute: '/',
onGenerateRoute: Router.generateRoute,

The flutter tutorial  is a website that bring you the latest and amazing resources of code. All the languages codes are included in this website. The languages like flutter, android, java,kotlin etc.with the help of this languages any user can develop the beautiful application

For more information about Flutter. visit