File tree Expand file tree Collapse file tree 7 files changed +19
-11
lines changed
examples/leak_tracking/lib
pkgs/leak_tracker_flutter_testing Expand file tree Collapse file tree 7 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ import 'package:leak_tracker/leak_tracker.dart';
44
55void main () {
66 LeakTracking .start ();
7- MemoryAllocations .instance.addListener (
7+ // Dispatch memory events from the Flutter engine to LeakTracking.
8+ FlutterMemoryAllocations .instance.addListener (
89 (ObjectEvent event) => LeakTracking .dispatchObjectEvent (event.toMap ()),
910 );
1011
Original file line number Diff line number Diff line change 1+ ## 2.0.2
2+
3+ * Replaced depracated ` MemoryAllocations ` with ` FlutterMemoryAllocations ` .
4+
15## 2.0.1
26
37* Upgrade to leak_tracker 10.0.0 and leak_tracker_testing 2.0.1.
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import 'package:flutter/foundation.dart';
88import 'package:matcher/matcher.dart' ;
99
1010/// Invokes [callback] and collects
11- /// events dispatched to [MemoryAllocations .instance] for [type] .
11+ /// events dispatched to [FlutterMemoryAllocations .instance] for [type] .
1212Future <List <ObjectEvent >> memoryEvents (
1313 FutureOr <void > Function () callback,
1414 Type type,
@@ -21,9 +21,9 @@ Future<List<ObjectEvent>> memoryEvents(
2121 }
2222 }
2323
24- MemoryAllocations .instance.addListener (listener);
24+ FlutterMemoryAllocations .instance.addListener (listener);
2525 await callback ();
26- MemoryAllocations .instance.removeListener (listener);
26+ FlutterMemoryAllocations .instance.removeListener (listener);
2727
2828 return events;
2929}
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ Future<void> maybeTearDownLeakTrackingForAll() async {
6060
6161 // The listener is not added/removed for each test,
6262 // because GC may happen after test is complete.
63- MemoryAllocations .instance.removeListener (_dispatchFlutterEventToLeakTracker);
63+ FlutterMemoryAllocations .instance
64+ .removeListener (_dispatchFlutterEventToLeakTracker);
6465 await forceGC (fullGcCycles: defaultNumberOfGcCycles);
6566 LeakTracking .declareNotDisposedObjectsAsLeaks ();
6667 final leaks = await LeakTracking .collectLeaks ();
@@ -107,5 +108,6 @@ void _maybeStartLeakTracking() {
107108
108109 LeakTracking .phase = const PhaseSettings .ignored ();
109110 LeakTracking .start (config: LeakTrackingConfig .passive ());
110- MemoryAllocations .instance.addListener (_dispatchFlutterEventToLeakTracker);
111+ FlutterMemoryAllocations .instance
112+ .addListener (_dispatchFlutterEventToLeakTracker);
111113}
Original file line number Diff line number Diff line change 11name : leak_tracker_flutter_testing
2- version : 2.0.1
2+ version : 2.0.2
33description : An internal package to test leak tracking with Flutter.
44repository : https://github.com/dart-lang/leak_tracker/tree/main/pkgs/leak_tracker_flutter_testing
55
66environment :
7- sdk : ' >=3.1.2 <4.0.0'
7+ sdk : ' >=3.2.0 <4.0.0'
8+ flutter : ' >=3.18.0-18.0.pre.54'
89
910dependencies :
1011 flutter :
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ void main() {
1414 test ('dispatchObjectEvent dispatches Flutter SDK instrumentation.' , () {
1515 final tracker = EventTracker ();
1616
17- MemoryAllocations .instance.addListener (
17+ FlutterMemoryAllocations .instance.addListener (
1818 (event) => dispatchObjectEvent (
1919 event.toMap (),
2020 onStartTracking: tracker.dispatchObjectCreated,
Original file line number Diff line number Diff line change @@ -8,15 +8,15 @@ import 'package:test/test.dart';
88
99class _TrackedClass {
1010 _TrackedClass () {
11- MemoryAllocations .instance.dispatchObjectCreated (
11+ FlutterMemoryAllocations .instance.dispatchObjectCreated (
1212 library: 'library' ,
1313 className: '_TrackedClass' ,
1414 object: this ,
1515 );
1616 }
1717
1818 void dispose () {
19- MemoryAllocations .instance.dispatchObjectDisposed (object: this );
19+ FlutterMemoryAllocations .instance.dispatchObjectDisposed (object: this );
2020 }
2121}
2222
You can’t perform that action at this time.
0 commit comments