File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -261,7 +261,17 @@ class ScrollDragController implements Drag {
261261 _retainMomentum = carriedVelocity != null && carriedVelocity != 0.0 ,
262262 _lastNonStationaryTimestamp = details.sourceTimeStamp,
263263 _kind = details.kind,
264- _offsetSinceLastStop = motionStartDistanceThreshold == null ? null : 0.0 ;
264+ _offsetSinceLastStop = motionStartDistanceThreshold == null ? null : 0.0 {
265+ // TODO(polina-c): stop duplicating code across disposables
266+ // https://github.com/flutter/flutter/issues/137435
267+ if (kFlutterMemoryAllocationsEnabled) {
268+ MemoryAllocations .instance.dispatchObjectCreated (
269+ library: 'package:flutter/widgets.dart' ,
270+ className: '$ScrollDragController ' ,
271+ object: this ,
272+ );
273+ }
274+ }
265275
266276 /// The object that will actuate the scroll view as the user drags.
267277 ScrollActivityDelegate get delegate => _delegate;
@@ -437,6 +447,11 @@ class ScrollDragController implements Drag {
437447 /// Called by the delegate when it is no longer sending events to this object.
438448 @mustCallSuper
439449 void dispose () {
450+ // TODO(polina-c): stop duplicating code across disposables
451+ // https://github.com/flutter/flutter/issues/137435
452+ if (kFlutterMemoryAllocationsEnabled) {
453+ MemoryAllocations .instance.dispatchObjectDisposed (object: this );
454+ }
440455 _lastDetails = null ;
441456 onDragCanceled? .call ();
442457 }
Original file line number Diff line number Diff line change @@ -222,6 +222,19 @@ void main() {
222222 areCreateAndDispose,
223223 );
224224 });
225+
226+ test ('$ScrollDragController dispatches memory events' , () async {
227+ await expectLater (
228+ await memoryEvents (
229+ () => ScrollDragController (
230+ delegate: _ScrollActivityDelegate (),
231+ details: DragStartDetails (),
232+ ).dispose (),
233+ ScrollDragController ,
234+ ),
235+ areCreateAndDispose,
236+ );
237+ });
225238}
226239
227240class PageView62209 extends StatefulWidget {
You can’t perform that action at this time.
0 commit comments