GoNavigator constructor

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

Constructs a GoNavigator with the provided initial route and routes map.

Throws an Exception if the routes map is empty or if it does not contain an entry for the root route (/).

Implementation

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

  if (!routes.containsKey('/')) {
    throw Exception('Routes map must have a route assigned to [/]');
  }
}