nonNullType function

String nonNullType(
  1. Type type
)

Returns the non‑nullable form of a Type.

  • Removes a trailing ? from the type’s string representation.

Implementation

String nonNullType(Type type) {
  final typeString = type.toString();
  return typeString.endsWith("?") ? typeString.substring(0, typeString.length - 1) : typeString;
}