type library Null safety

Defines the type model. The type model is part of the element model in that most types are defined by Dart code (the types dynamic and void being the notable exceptions). All types are represented by an instance of a subclass of DartType.

Other than dynamic and void, all of the types define either the interface defined by a class (an instance of InterfaceType) or the type of a function (an instance of FunctionType).

We make a distinction between the declaration of a class (a ClassElement) and the type defined by that class (an InterfaceType). The biggest reason for the distinction is to allow us to more cleanly represent the distinction between type parameters and type arguments. For example, if we define a class as class Pair<K, V> {}, the declarations of K and V represent type parameters. But if we declare a variable as Pair<String, int> pair; the references to String and int are type arguments.

Classes

DartType
The type associated with elements in the element model. [...]
DynamicType
The type dynamic is a type which is a supertype of all other types, just like Object, with the difference that the static analysis assumes that every member access has a corresponding member with a signature that admits the given access.
FunctionType
The type of a function, method, constructor, getter, or setter. Function types come in three variations: [...]
InterfaceType
The type introduced by either a class or an interface, or a reference to such a type. [...]
NeverType
The type Never represents the uninhabited bottom type.
ParameterizedType
A type that can track substituted type parameters, either for itself after instantiation, or from a surrounding context. [...]
TypeParameterType
The type introduced by a type parameter. [...]
VoidType
The special type void is used to indicate that the value of an expression is meaningless, and intended to be discarded.