From 49deeb9e5b534b64274777fc4db6f38e359b2509 Mon Sep 17 00:00:00 2001 From: Brett Morgan Date: Mon, 12 Jun 2023 13:47:29 +1000 Subject: [PATCH] `next_gen_ui_demo`: Add `leak_tracker` --- next_gen_ui_demo/lib/main.dart | 5 +++++ next_gen_ui_demo/pubspec.yaml | 1 + 2 files changed, 6 insertions(+) diff --git a/next_gen_ui_demo/lib/main.dart b/next_gen_ui_demo/lib/main.dart index 145738f564e..59f79ff84a1 100644 --- a/next_gen_ui_demo/lib/main.dart +++ b/next_gen_ui_demo/lib/main.dart @@ -8,6 +8,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:gap/gap.dart'; +import 'package:leak_tracker/leak_tracker.dart'; import 'package:provider/provider.dart'; import 'package:window_size/window_size.dart'; @@ -30,6 +31,10 @@ import 'title_screen_5b/title_screen.dart' as title_screen_5b; import 'title_screen_6/title_screen.dart' as title_screen_6; void main() { + enableLeakTracking(); + MemoryAllocations.instance + .addListener((event) => dispatchObjectEvent(event.toMap())); + if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) { WidgetsFlutterBinding.ensureInitialized(); setWindowMinSize(const Size(800, 500)); diff --git a/next_gen_ui_demo/pubspec.yaml b/next_gen_ui_demo/pubspec.yaml index a2c7f0fb27a..337da575e35 100644 --- a/next_gen_ui_demo/pubspec.yaml +++ b/next_gen_ui_demo/pubspec.yaml @@ -15,6 +15,7 @@ dependencies: flutter_animate: ^4.1.1+1 focusable_control_builder: ^1.0.1+1 gap: ^3.0.0 + leak_tracker: ^7.0.4 particle_field: ^1.0.0 provider: ^6.0.5 rnd: ^0.2.0