StrutStyle constructor Null safety

const StrutStyle(
  1. {String? fontFamily,
  2. List<String>? fontFamilyFallback,
  3. double? fontSize,
  4. double? height,
  5. TextLeadingDistribution? leadingDistribution,
  6. double? leading,
  7. FontWeight? fontWeight,
  8. FontStyle? fontStyle,
  9. bool? forceStrutHeight,
  10. String? debugLabel,
  11. String? package}
)

Creates a strut style.

The package argument must be non-null if the font family is defined in a package. It is combined with the fontFamily argument to set the fontFamily property.

If provided, fontSize must be positive and non-zero, leading must be zero or positive.

Implementation

const StrutStyle({
  String? fontFamily,
  List<String>? fontFamilyFallback,
  this.fontSize,
  this.height,
  this.leadingDistribution,
  this.leading,
  this.fontWeight,
  this.fontStyle,
  this.forceStrutHeight,
  this.debugLabel,
  String? package,
}) : fontFamily = package == null ? fontFamily : 'packages/$package/$fontFamily',
     _fontFamilyFallback = fontFamilyFallback,
     _package = package,
     assert(fontSize == null || fontSize > 0),
     assert(leading == null || leading >= 0),
     assert(package == null || (fontFamily != null || fontFamilyFallback != null));