update method
Writes the delta; omitted fields keep their value. Notifies only when something actually changed, so an idle writer costs nothing.
A scale of ZERO is legal and deflates the mass to nothing - births and deaths are mass, not opacity (the selection-blob pattern). Content of a fully deflated piece paints as nothing and is skipped by hit testing (the transform degenerates).
Implementation
void update({Offset? offset, double? scaleX, double? scaleY}) {
assert(scaleX == null || scaleX >= 0, 'channel scaleX cannot be negative.');
assert(scaleY == null || scaleY >= 0, 'channel scaleY cannot be negative.');
final Offset nextOffset = offset ?? _offset;
final double nextScaleX = scaleX ?? _scaleX;
final double nextScaleY = scaleY ?? _scaleY;
if (nextOffset == _offset &&
nextScaleX == _scaleX &&
nextScaleY == _scaleY) {
return;
}
_offset = nextOffset;
_scaleX = nextScaleX;
_scaleY = nextScaleY;
notifyListeners();
}