@@ -311,7 +311,17 @@ abstract interface class DecorationImagePainter {
311311}
312312
313313class _DecorationImagePainter implements DecorationImagePainter {
314- _DecorationImagePainter ._(this ._details, this ._onChanged);
314+ _DecorationImagePainter ._(this ._details, this ._onChanged) {
315+ // TODO(polina-c): stop duplicating code across disposables
316+ // https://github.com/flutter/flutter/issues/137435
317+ if (kFlutterMemoryAllocationsEnabled) {
318+ FlutterMemoryAllocations .instance.dispatchObjectCreated (
319+ library: 'package:flutter/painting.dart' ,
320+ className: '$_DecorationImagePainter ' ,
321+ object: this ,
322+ );
323+ }
324+ }
315325
316326 final DecorationImage _details;
317327 final VoidCallback _onChanged;
@@ -404,6 +414,9 @@ class _DecorationImagePainter implements DecorationImagePainter {
404414
405415 @override
406416 void dispose () {
417+ if (kFlutterMemoryAllocationsEnabled) {
418+ FlutterMemoryAllocations .instance.dispatchObjectDisposed (object: this );
419+ }
407420 _imageStream? .removeListener (ImageStreamListener (
408421 _handleImage,
409422 onError: _details.onError,
@@ -801,7 +814,17 @@ class _BlendedDecorationImage implements DecorationImage {
801814}
802815
803816class _BlendedDecorationImagePainter implements DecorationImagePainter {
804- _BlendedDecorationImagePainter ._(this .a, this .b, this .t);
817+ _BlendedDecorationImagePainter ._(this .a, this .b, this .t) {
818+ // TODO(polina-c): stop duplicating code across disposables
819+ // https://github.com/flutter/flutter/issues/137435
820+ if (kFlutterMemoryAllocationsEnabled) {
821+ FlutterMemoryAllocations .instance.dispatchObjectCreated (
822+ library: 'package:flutter/painting.dart' ,
823+ className: '$_BlendedDecorationImagePainter ' ,
824+ object: this ,
825+ );
826+ }
827+ }
805828
806829 final DecorationImagePainter ? a;
807830 final DecorationImagePainter ? b;
@@ -817,6 +840,9 @@ class _BlendedDecorationImagePainter implements DecorationImagePainter {
817840
818841 @override
819842 void dispose () {
843+ if (kFlutterMemoryAllocationsEnabled) {
844+ FlutterMemoryAllocations .instance.dispatchObjectDisposed (object: this );
845+ }
820846 a? .dispose ();
821847 b? .dispose ();
822848 }
0 commit comments