debugFillProperties method Null safety

  1. @override
void debugFillProperties(
  1. DiagnosticPropertiesBuilder properties,
  2. {String prefix = ''}

Adds all properties prefixing property names with the optional prefix.


void debugFillProperties(DiagnosticPropertiesBuilder properties, { String prefix = '' }) {
  if (debugLabel != null) {
    properties.add(MessageProperty('${prefix}debugLabel', debugLabel!));
  final List<DiagnosticsNode> styles = <DiagnosticsNode>[
    StringProperty('${prefix}family', fontFamily, defaultValue: null, quoted: false),
    IterableProperty<String>('${prefix}familyFallback', fontFamilyFallback, defaultValue: null),
    DoubleProperty('${prefix}size', fontSize, defaultValue: null),
  String? weightDescription;
  if (fontWeight != null) {
    weightDescription = 'w${fontWeight!.index + 1}00';
  // TODO(jacobr): switch this to use enumProperty which will either cause the
  // weight description to change to w600 from 600 or require existing
  // enumProperty to handle this special case.
    description: weightDescription,
    defaultValue: null,
  styles.add(EnumProperty<FontStyle>('${prefix}style', fontStyle, defaultValue: null));
  styles.add(DoubleProperty('${prefix}height', height, unit: 'x', defaultValue: null));
  styles.add(FlagProperty('${prefix}forceStrutHeight', value: forceStrutHeight, ifTrue: '$prefix<strut height forced>', ifFalse: '$prefix<strut height normal>'));

  final bool styleSpecified = styles.any((DiagnosticsNode n) => !n.isFiltered(;

  if (!styleSpecified) {
    properties.add(FlagProperty('forceStrutHeight', value: forceStrutHeight, ifTrue: '$prefix<strut height forced>', ifFalse: '$prefix<strut height normal>'));