showCombinator method

String? showCombinator({
  1. bool includeIgnores = false,
})

Implementation

String? showCombinator({bool includeIgnores = false}) {
  if (associatedElement case Element(
    :final displayName,
    metadata: Metadata(:final annotations),
  )) {
    final ignores = <String>{};
    if (includeIgnores) {
      for (final annotation in annotations) {
        if (annotation.isDeprecated) {
          ignores.add('deprecated_member_use');
        }
      }
    }

    if (ignores.isNotEmpty) {
      return [
        'show',
        '// ignore: ${ignores.join(', ')}',
        '$displayName',
      ].join('\n');
    }

    return 'show $displayName';
  }

  return null;
}