getNullableType function

String getNullableType(
  1. String type
)

Implementation

String getNullableType(String type) {
  if (type.trim().endsWith('?')) {
    return type;
  }

  switch (type) {
    case 'Null':
    case 'dynamic':
    case 'void':
      return type;
    default:
      return '$type?';
  }
}