GoNavigator constructor

GoNavigator({
  1. required Widget initialRoute,
  2. required Map<String, Widget Function(BuildContext, Map<String, dynamic>?)> routes,
})

Creates a new instance of NavigationRouteBuilder to manage routes in the application.

  • initialRoute: The widget that represents the initial route of the application.
  • routes: A map that associates route names with corresponding widget constructors.

Throws an exception if the routes map is empty.

Implementation

GoNavigator({
  required this.initialRoute,
  required this.routes,
}) {
  if (routes.isEmpty) {
    throw Exception('Routes map cannot be empty.');
  }

  if (initialRoute == null) {
    throw Exception('Routes map cannot be empty.');
  }
}