RestorationManager should dispatch creation in constructor. (#133911)

This commit is contained in:
Polina Cherkasova
2023-09-08 15:05:43 -07:00
committed by GitHub
parent 621ad9872c
commit 834f5dc296
2 changed files with 8 additions and 0 deletions

View File

@@ -154,6 +154,9 @@ class RestorationManager extends ChangeNotifier {
/// Construct the restoration manager and set up the communications channels
/// with the engine to get restoration messages (by calling [initChannels]).
RestorationManager() {
if (kFlutterMemoryAllocationsEnabled) {
maybeDispatchObjectCreation();
}
initChannels();
}

View File

@@ -8,10 +8,15 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import 'restoration.dart';
void main() {
testWidgetsWithLeakTracking('$RestorationManager dispatches memory events', (WidgetTester tester) async {
expect(() => RestorationManager().dispose(), dispatchesMemoryEvents(RestorationManager));
});
group('RestorationManager', () {
testWidgets('root bucket retrieval', (WidgetTester tester) async {
final List<MethodCall> callsToEngine = <MethodCall>[];