fontFamilyFallback property

List<String> fontFamilyFallback

The ordered list of font families to fall back on when a higher priority font family cannot be found.

The value provided in fontFamily will act as the preferred/first font family that will be searched for, followed in order by the font families in fontFamilyFallback. If all font families are exhausted and no match was found, the default platform font family will be used instead. Unlike TextStyle.fontFamilyFallback, the font does not need to contain the desired glyphs to match.

When fontFamily is null or not provided, the first value in fontFamilyFallback acts as the preferred/first font family. When neither is provided, then the default platform font will be used. Providing and empty list or null for this property is the same as omitting it.

If the font is defined in a package, each font family in the list will be prefixed with 'packages/package_name/' (e.g. 'packages/cool_fonts/Roboto'). The package name should be provided by the package argument in the constructor.

Implementation

List<String> get fontFamilyFallback {
  if (_package != null && _fontFamilyFallback != null)
    return _fontFamilyFallback.map((String family) => 'packages/$_package/$family').toList();
  return _fontFamilyFallback;
}