Document that you can't change initialRoute usefully (#130450)

Fixes https://github.com/flutter/flutter/issues/12454
This commit is contained in:
Ian Hickson 2023-07-19 17:41:51 -07:00 committed by GitHub
parent 28dfd836e2
commit 9c8ee4fab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -725,6 +725,10 @@ class WidgetsApp extends StatefulWidget {
/// [routes], [onGenerateRoute], or [onUnknownRoute]); if they are not,
/// [initialRoute] must be null and [builder] must not be null.
///
/// Changing the [initialRoute] will have no effect, as it only controls the
/// _initial_ route. To change the route while the application is running, use
/// the [Navigator] or [Router] APIs.
///
/// See also:
///
/// * [Navigator.initialRoute], which is used to implement this property.

View File

@ -1470,6 +1470,10 @@ class Navigator extends StatefulWidget {
///
/// The value is interpreted according to [onGenerateInitialRoutes], which
/// defaults to [defaultGenerateInitialRoutes].
///
/// Changing the [initialRoute] will have no effect, as it only controls the
/// _initial_ route. To change the route while the application is running, use
/// the static functions on this class, such as [push] or [replace].
final String? initialRoute;
/// Called to generate a route for a given [RouteSettings].