background property Null safety

Paint? background
final

The paint drawn as a background for the text.

The value should ideally be cached and reused each time if multiple text styles are created with the same paint settings. Otherwise, each time it will appear like the style changed, which will result in unnecessary updates all the way through the framework.

If backgroundColor is specified, this value must be null. The backgroundColor property is shorthand for background: Paint()..color = backgroundColor.

In merge, apply, and lerp, conflicts between backgroundColor and background specification are resolved in background's favor - i.e. if background is specified in one place, it will dominate backgroundColor in another.

Implementation

final Paint? background;