Deprecate MemoryAllocations in favor of FlutterMemoryAllocations
Summary
#
Disposables in pure Dart projects can't use MemoryAllocations in Flutter.
So, to be leak-trackable they need a Dart-only class.
MemoryAllocations in Flutter is renamed to make the name
available to a non-Flutter, Dart project.
Migration guide
#Before:
dart
if (kFlutterMemoryAllocationsEnabled) {
MemoryAllocations.instance.dispatchObjectCreated(
library: 'package:flutter/gestures.dart',
className: '$MultiDragPointerState',
object: this,
);
}
After:
dart
if (kFlutterMemoryAllocationsEnabled) {
FlutterMemoryAllocations.instance.dispatchObjectCreated(
library: 'package:flutter/gestures.dart',
className: '$MultiDragPointerState',
object: this,
);
}
Timeline
#
Landed in version: 3.19.0-2.0.pre
Landed in stable: 3.22.0
References
#Relevant issues:
本页内容对你有帮助吗?
除非另有说明,本文档之所提及适用于 Flutter 3.38.1 版本。本页面最后更新时间:2025-10-30。查看文档源码 或者 为本页面内容提出建议。