Make RouteInformationProvider value non nullable (#83301)
* Make RouteInformationProvider value non nullable * fix more lint
This commit is contained in:
parent
1b20072650
commit
36eea758ac
@ -491,7 +491,7 @@ class _RouterState<T> extends State<Router<T>> with RestorationMixin {
|
|||||||
if (_routeInformation.value != null) {
|
if (_routeInformation.value != null) {
|
||||||
_processRouteInformation(_routeInformation.value!, () => widget.routerDelegate.setRestoredRoutePath);
|
_processRouteInformation(_routeInformation.value!, () => widget.routerDelegate.setRestoredRoutePath);
|
||||||
} else if (widget.routeInformationProvider != null) {
|
} else if (widget.routeInformationProvider != null) {
|
||||||
_processRouteInformation(widget.routeInformationProvider!.value!, () => widget.routerDelegate.setInitialRoutePath);
|
_processRouteInformation(widget.routeInformationProvider!.value, () => widget.routerDelegate.setInitialRoutePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ class _RouterState<T> extends State<Router<T>> with RestorationMixin {
|
|||||||
|
|
||||||
void _handleRouteInformationProviderNotification() {
|
void _handleRouteInformationProviderNotification() {
|
||||||
assert(widget.routeInformationProvider!.value != null);
|
assert(widget.routeInformationProvider!.value != null);
|
||||||
_processRouteInformation(widget.routeInformationProvider!.value!, () => widget.routerDelegate.setNewRoutePath);
|
_processRouteInformation(widget.routeInformationProvider!.value, () => widget.routerDelegate.setNewRoutePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _handleBackButtonDispatcherNotification() {
|
Future<bool> _handleBackButtonDispatcherNotification() {
|
||||||
@ -1300,7 +1300,7 @@ abstract class RouterDelegate<T> extends Listenable {
|
|||||||
/// intent to the [Router] widget, as well as reports new route information
|
/// intent to the [Router] widget, as well as reports new route information
|
||||||
/// from the [Router] back to the engine by overriding the
|
/// from the [Router] back to the engine by overriding the
|
||||||
/// [routerReportsNewRouteInformation].
|
/// [routerReportsNewRouteInformation].
|
||||||
abstract class RouteInformationProvider extends ValueListenable<RouteInformation?> {
|
abstract class RouteInformationProvider extends ValueListenable<RouteInformation> {
|
||||||
/// A callback called when the [Router] widget detects any navigation event
|
/// A callback called when the [Router] widget detects any navigation event
|
||||||
/// due to state changes.
|
/// due to state changes.
|
||||||
///
|
///
|
||||||
@ -1329,7 +1329,7 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
|
|||||||
/// Use the [initialRouteInformation] to set the default route information for this
|
/// Use the [initialRouteInformation] to set the default route information for this
|
||||||
/// provider.
|
/// provider.
|
||||||
PlatformRouteInformationProvider({
|
PlatformRouteInformationProvider({
|
||||||
RouteInformation? initialRouteInformation,
|
required RouteInformation initialRouteInformation,
|
||||||
}) : _value = initialRouteInformation;
|
}) : _value = initialRouteInformation;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -1343,8 +1343,8 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RouteInformation? get value => _value;
|
RouteInformation get value => _value;
|
||||||
RouteInformation? _value;
|
RouteInformation _value;
|
||||||
|
|
||||||
void _platformReportsNewRouteInformation(RouteInformation routeInformation) {
|
void _platformReportsNewRouteInformation(RouteInformation routeInformation) {
|
||||||
if (_value == routeInformation)
|
if (_value == routeInformation)
|
||||||
|
@ -129,9 +129,9 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
|
|||||||
|
|
||||||
class _TestRouteInformationProvider extends RouteInformationProvider with ChangeNotifier {
|
class _TestRouteInformationProvider extends RouteInformationProvider with ChangeNotifier {
|
||||||
@override
|
@override
|
||||||
RouteInformation? get value => _value;
|
RouteInformation get value => _value;
|
||||||
RouteInformation? _value = const RouteInformation(location: '/home');
|
RouteInformation _value = const RouteInformation(location: '/home');
|
||||||
set value(RouteInformation? value) {
|
set value(RouteInformation value) {
|
||||||
if (value == _value) {
|
if (value == _value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user