onGenerateInitialRoutes property

RouteListFactory onGenerateInitialRoutes

Called when the widget is created to generate the initial list of Route objects if initialRoute is not null.

Defaults to defaultGenerateInitialRoutes.

The NavigatorState and initialRoute will be passed to the callback. The callback must return a list of Route objects with which the history will be primed.

When parsing the initialRoute, if there's any chance that the it may contain complex characters, it's best to use the characters API. This will ensure that extended grapheme clusters and surrogate pairs are treated as single characters by the code, the same way that they appear to the user. For example, the string "👨‍👩‍👦" appears to the user as a single character and string.characters.length intuitively returns 1. On the other hand, string.length returns 8, and string.runes.length returns 5!


final RouteListFactory onGenerateInitialRoutes;