resolveType static method

Type resolveType(
  1. DartType? dartType

Returns a type Type that matches dartType and instance of DartType.

Returns UnknownType if no match is found.


static Type resolveType(DartType? dartType) {
  if (dartType == null) return UnknownType;
  if (dartType.isDartCoreString) return String;
  if (dartType.isDartCoreBool) return bool;
  if (dartType.isDartCoreInt) return int;
  if (dartType.isDartCoreDouble) return double;
  if (dartType.isDartCoreNum) return num;
  if (dartType is DynamicType) return dynamic;
  if (dartType.isDartCoreNull) return Null;
  if (dartType.isDartCoreSymbol) return Symbol;
  return _resolvedTypes[dartType] ?? UnknownType;