fontVariations property Null safety

List<FontVariation>? fontVariations
final

A list of FontVariations that affect how a variable font is rendered.

Some fonts are variable fonts that can generate multiple font faces based on the values of customizable attributes. For example, a variable font may have a weight axis that can be set to a value between 1 and 1000. FontVariations can be used to select the values of these design axes.

For example, to control the weight axis of the Roboto Slab variable font (https://fonts.google.com/specimen/Roboto+Slab):

const TextStyle(
  fontFamily: 'RobotoSlab',
  fontVariations: <ui.FontVariation>[ui.FontVariation('wght', 900.0)]
)

Implementation

final List<ui.FontVariation>? fontVariations;