title: onGenerateRoute: router.generateRoute; Try correcting the prefix or importing the library that defines 'generateRoute'
body: <p><strong>Below is the main.dart code. Getting error on generateRoute -&gt; onGenerateRoute: router.generateRoute. Error is</strong></p>
  <blockquote>
  <p>The name 'generateRoute' is being referenced through the prefix 'router', but it isn't defined in any of the libraries imported using that prefix. (Documentation)  Try correcting the prefix or importing the library that defines 'generateRoute'. Please help.</p>
  </blockquote>
  <pre><code>import 'package:flutter/services.dart';
  import 'package:flutter_localizations/flutter_localizations.dart';
  import 'package:initsurvey/core/router.dart' as router;
  import 'package:initsurvey/repository/survey/survey_provider.dart';
  import 'package:initsurvey/theme/app_theme.dart';
  import 'package:provider/provider.dart';
  
  import 'locale/app_translations_delegate.dart';
  import 'locale/application.dart';
  
      void main() {
    WidgetsFlutterBinding.ensureInitialized();
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.light
        .copyWith(statusBarIconBrightness: Brightness.light));
  
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
  
  //  ErrorWidget.builder = (FlutterErrorDetails details) =&gt; Container(
  //    alignment: Alignment.center,
  //    child: Icon(Icons.error),
  //  );
    runApp(MyApp());
  }
  
  class MyApp extends StatefulWidget {
    static final GlobalKey&lt;NavigatorState&gt; navKey =  GlobalKey&lt;NavigatorState&gt;();
  
    @override
    _MyAppState createState() =&gt; _MyAppState();
  }
  
  class _MyAppState extends State&lt;MyApp&gt; {
    AppTranslationsDelegate _newLocaleDelegate;
  
    @override
    Widget build(BuildContext context) {
      return MultiProvider(
        providers: [
          ChangeNotifierProvider(create: (_)=&gt;SurveyProvider(),)
        ],
        child: MaterialApp(
          debugShowCheckedModeBanner: false,
          localizationsDelegates: [
            _newLocaleDelegate,
            const AppTranslationsDelegate(),
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
          ],
          supportedLocales: Application.instance.supportedLocales(),
          navigatorKey: MyApp.navKey,
          title: 'My Flutter App',
          theme: primaryTheme,
          initialRoute: '/',
          onGenerateRoute: router.generateRoute,
        ),
      );
    }
  </code></pre>
  <p><strong>This is the router.dart file code</strong></p>
  <pre><code>    class Router {
    static Route&lt;dynamic&gt; generateRoute(RouteSettings settings) {
      /// add settings on MaterialPageRoute for which route you want tracking
      switch (settings.name) {
        case '/':
          return MaterialPageRoute(
              builder: (_) =&gt; InitView(), settings: settings);
        case '/login':
          return MaterialPageRoute(
              builder: (_) =&gt; LoginView(), settings: settings);
        case '/home':
          return MaterialPageRoute(
              builder: (_) =&gt; HomeView(), settings: settings);
        case '/result-view':
          return MaterialPageRoute(
              builder: (_) =&gt; ResultView(settings.arguments), settings: settings);
        case '/contact':
          return MaterialPageRoute(
              builder: (_) =&gt; ContactView(), settings: settings);
        case '/step-view':
          return MaterialPageRoute(
              builder: (_) =&gt; SurveyView(), settings: settings);
        case '/search-address':
          return MaterialPageRoute(
              builder: (_) =&gt; SearchAddressView(), settings: settings);
        default:
          return MaterialPageRoute(
              builder: (_) =&gt; EmptyView(title: settings.name));
      }
    }
  
    static String getNameExtractor(RouteSettings settings) {
      /// User for override route's name
      switch (settings.name) {
        case '/':
          return null;
        default:
          return settings.name;
      }
    }
  }
  </code></pre>