Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabController should dispatch creation in constructor. [prod-leak-fix] #133952

Merged
merged 15 commits into from
Sep 22, 2023
Merged
Prev Previous commit
Next Next commit
-
  • Loading branch information
polina-c committed Sep 22, 2023
commit c70c633ba42902b61f7e29df06f563f96caaf901
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/tab_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 117,7 @@ class TabController extends ChangeNotifier {
vsync: vsync,
) {
if (kFlutterMemoryAllocationsEnabled) {
maybeDispatchObjectCreation();
ChangeNotifier.maybeDispatchObjectCreation(this);
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/flutter/test/material/tab_controller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 8,9 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';

void main() {
testWidgetsWithLeakTracking('$TabController dispatches creation in constructor.', (WidgetTester widgetTester) async {
expect(() => TabController(length: 1, vsync: const TestVSync()).dispose(), dispatchesMemoryEvents(TabController));
await expectLater(
await memoryEvents(() async => TabController(length: 1, vsync: const TestVSync()).dispose(), TabController),
areCreateAndDispose,
);
});
}