paint method Null safety
Paints the Decoration for which this object was created on the given canvas using the given configuration.
If this object caches resources for painting (e.g. Paint objects), the cache may be flushed when paint is called with a new configuration. For this reason, it may be more efficient to call Decoration.createBoxPainter for each different rectangle that is being painted in a particular frame.
For example, if a decoration's owner wants to paint a particular decoration once for its whole size, and once just in the bottom right, it might get two BoxPainter instances, one for each. However, when its size changes, it could continue using those same instances, since the previous resources would no longer be relevant and thus losing them would not be an issue.
Implementations should paint their decorations on the canvas in a
rectangle whose top left corner is at the given
offset and whose size is
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration);