of static method

WrittenCollectionType? of(
  1. Object? collection
)

collection's written type, or null when it has none recorded.

Implementation

static WrittenCollectionType? of(Object? collection) {
  final arguments = writtenCollectionTypeArgumentsOf(collection);
  if (arguments == null) return null;
  final native = collection.runtimeType.toString();
  final open = native.indexOf('<');
  return WrittenCollectionType(
    open < 0 ? native : native.substring(0, open),
    arguments,
  );
}