nullabilitySuffix property

String nullabilitySuffix

Return a dartdoc nullability suffix for this type.

Implementation

String get nullabilitySuffix {
  if (library.isNullSafety && !type.isVoid && !type.isBottom) {
    /// If a legacy type appears inside the public interface of a Null
    /// safety library, we pretend it is nullable for the purpose of
    /// documentation (since star-types are not supposed to be public).
    if (type.nullabilitySuffix == NullabilitySuffix.question ||
        type.nullabilitySuffix == NullabilitySuffix.star) {
      return '?';
    }
  }
  return '';
}