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) {
|
||||
_processRouteInformation(_routeInformation.value!, () => widget.routerDelegate.setRestoredRoutePath);
|
||||
} 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() {
|
||||
assert(widget.routeInformationProvider!.value != null);
|
||||
_processRouteInformation(widget.routeInformationProvider!.value!, () => widget.routerDelegate.setNewRoutePath);
|
||||
_processRouteInformation(widget.routeInformationProvider!.value, () => widget.routerDelegate.setNewRoutePath);
|
||||
}
|
||||
|
||||
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
|
||||
/// from the [Router] back to the engine by overriding the
|
||||
/// [routerReportsNewRouteInformation].
|
||||
abstract class RouteInformationProvider extends ValueListenable<RouteInformation?> {
|
||||
abstract class RouteInformationProvider extends ValueListenable<RouteInformation> {
|
||||
/// A callback called when the [Router] widget detects any navigation event
|
||||
/// 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
|
||||
/// provider.
|
||||
PlatformRouteInformationProvider({
|
||||
RouteInformation? initialRouteInformation,
|
||||
required RouteInformation initialRouteInformation,
|
||||
}) : _value = initialRouteInformation;
|
||||
|
||||
@override
|
||||
@ -1343,8 +1343,8 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
|
||||
}
|
||||
|
||||
@override
|
||||
RouteInformation? get value => _value;
|
||||
RouteInformation? _value;
|
||||
RouteInformation get value => _value;
|
||||
RouteInformation _value;
|
||||
|
||||
void _platformReportsNewRouteInformation(RouteInformation routeInformation) {
|
||||
if (_value == routeInformation)
|
||||
|
@ -129,9 +129,9 @@ class _TestRouterDelegate extends RouterDelegate<String> with ChangeNotifier {
|
||||
|
||||
class _TestRouteInformationProvider extends RouteInformationProvider with ChangeNotifier {
|
||||
@override
|
||||
RouteInformation? get value => _value;
|
||||
RouteInformation? _value = const RouteInformation(location: '/home');
|
||||
set value(RouteInformation? value) {
|
||||
RouteInformation get value => _value;
|
||||
RouteInformation _value = const RouteInformation(location: '/home');
|
||||
set value(RouteInformation value) {
|
||||
if (value == _value) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user