dispose method
Release resources held by this painter.
After calling this method, this object is no longer usable.
Implementation
void dispose() {
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if (kFlutterMemoryAllocationsEnabled) {
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
}
_textPainter?.dispose();
_textPainter = null;
}