PlatformRouteInformationProvider should dispatch creation in constructor. (#133353)
This commit is contained in:
parent
0027d18ee5
commit
2ea5296616
@ -1465,7 +1465,11 @@ class PlatformRouteInformationProvider extends RouteInformationProvider with Wid
|
|||||||
/// provider.
|
/// provider.
|
||||||
PlatformRouteInformationProvider({
|
PlatformRouteInformationProvider({
|
||||||
required RouteInformation initialRouteInformation,
|
required RouteInformation initialRouteInformation,
|
||||||
}) : _value = initialRouteInformation;
|
}) : _value = initialRouteInformation {
|
||||||
|
if (kFlutterMemoryAllocationsEnabled) {
|
||||||
|
maybeDispatchObjectCreation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool _equals(Uri a, Uri b) {
|
static bool _equals(Uri a, Uri b) {
|
||||||
return a.path == b.path
|
return a.path == b.path
|
||||||
|
@ -1161,6 +1161,7 @@ void main() {
|
|||||||
routerDelegate: delegate,
|
routerDelegate: delegate,
|
||||||
));
|
));
|
||||||
expect(tester.takeException(), isAssertionError);
|
expect(tester.takeException(), isAssertionError);
|
||||||
|
provider.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgetsWithLeakTracking('MaterialApp.router throw if route configuration is provided along with other delegate', (WidgetTester tester) async {
|
testWidgetsWithLeakTracking('MaterialApp.router throw if route configuration is provided along with other delegate', (WidgetTester tester) async {
|
||||||
|
@ -1582,6 +1582,21 @@ testWidgets('ChildBackButtonDispatcher take priority recursively', (WidgetTester
|
|||||||
expect(info2.location, '/abc?def=ghi&def=jkl#mno');
|
expect(info2.location, '/abc?def=ghi&def=jkl#mno');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('$PlatformRouteInformationProvider dispatches object creation in constructor', () {
|
||||||
|
int eventCount = 0;
|
||||||
|
void listener(ObjectEvent event) => eventCount++;
|
||||||
|
MemoryAllocations.instance.addListener(listener);
|
||||||
|
|
||||||
|
final PlatformRouteInformationProvider registry = PlatformRouteInformationProvider(
|
||||||
|
initialRouteInformation: RouteInformation(uri: Uri.parse('http://google.com')),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(eventCount, 1);
|
||||||
|
|
||||||
|
registry.dispose();
|
||||||
|
MemoryAllocations.instance.removeListener(listener);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildBoilerPlate(Widget child) {
|
Widget buildBoilerPlate(Widget child) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user