toString method

  1. @override
String toString ()
override

Returns a string representation of this object.

Implementation

@override
String toString() {
  final List<String> description = <String>[
    if (icon != null) 'icon: $icon',
    if (labelText != null) 'labelText: "$labelText"',
    if (helperText != null) 'helperText: "$helperText"',
    if (helperMaxLines != null) 'helperMaxLines: "$helperMaxLines"',
    if (hintText != null) 'hintText: "$hintText"',
    if (hintMaxLines != null) 'hintMaxLines: "$hintMaxLines"',
    if (errorText != null) 'errorText: "$errorText"',
    if (errorStyle != null) 'errorStyle: "$errorStyle"',
    if (errorMaxLines != null) 'errorMaxLines: "$errorMaxLines"',
    if (hasFloatingPlaceholder == false) 'hasFloatingPlaceholder: false',
    if (isDense ?? false) 'isDense: $isDense',
    if (contentPadding != null) 'contentPadding: $contentPadding',
    if (isCollapsed) 'isCollapsed: $isCollapsed',
    if (prefixIcon != null) 'prefixIcon: $prefixIcon',
    if (prefix != null) 'prefix: $prefix',
    if (prefixText != null) 'prefixText: $prefixText',
    if (prefixStyle != null) 'prefixStyle: $prefixStyle',
    if (suffixIcon != null) 'suffixIcon: $suffixIcon',
    if (suffix != null) 'suffix: $suffix',
    if (suffixText != null) 'suffixText: $suffixText',
    if (suffixStyle != null) 'suffixStyle: $suffixStyle',
    if (counter != null) 'counter: $counter',
    if (counterText != null) 'counterText: $counterText',
    if (counterStyle != null) 'counterStyle: $counterStyle',
    if (filled == true) 'filled: true', // filled == null same as filled == false
    if (fillColor != null) 'fillColor: $fillColor',
    if (focusColor != null) 'focusColor: $focusColor',
    if (hoverColor != null) 'hoverColor: $hoverColor',
    if (errorBorder != null) 'errorBorder: $errorBorder',
    if (focusedBorder != null) 'focusedBorder: $focusedBorder',
    if (focusedErrorBorder != null) 'focusedErrorBorder: $focusedErrorBorder',
    if (disabledBorder != null) 'disabledBorder: $disabledBorder',
    if (enabledBorder != null) 'enabledBorder: $enabledBorder',
    if (border != null) 'border: $border',
    if (!enabled) 'enabled: false',
    if (semanticCounterText != null) 'semanticCounterText: $semanticCounterText',
    if (alignLabelWithHint != null) 'alignLabelWithHint: $alignLabelWithHint',
  ];
  return 'InputDecoration(${description.join(', ')})';
}