toStringShort method Null safety

  1. @override
String toStringShort()
override

A brief description of this object, usually just the runtimeType and the hashCode.

See also:

  • toString, for a detailed description of the object.

Implementation

@override
String toStringShort() {
  final bool hasDebugLabel = debugLabel != null && debugLabel!.isNotEmpty;
  final String extraData = '${hasDebugLabel ? debugLabel : ''}'
      '${hasFocus && hasDebugLabel ? ' ' : ''}'
      '${hasFocus && !hasPrimaryFocus ? '[IN FOCUS PATH]' : ''}'
      '${hasPrimaryFocus ? '[PRIMARY FOCUS]' : ''}';
  return '${describeIdentity(this)}${extraData.isNotEmpty ? '($extraData)' : ''}';
}