FunctionType class

The type of a function, method, constructor, getter, or setter. Function types come in three variations:

  • The types of functions that only have required parameters. These have the general form (T1, …, Tn) → T.
  • The types of functions with optional positional parameters. These have the general form (T1, …, Tn, T<sub>n+1</sub> &hellip;, T<sub>n+k</sub>) → T.
  • The types of functions with named parameters. These have the general form (T1, …, Tn, {Tx1 x1, …, Txk xk}) → T.

Clients may not extend, implement or mix-in this class.

Implemented types

Constructors

FunctionType()

Properties

boundTypeParameters → List<TypeParameterElement>
Deprecated: use typeFormals.
read-only
namedParameterTypes → Map<String, DartType>
Return a map from the names of named parameters to the types of the named parameters of this type of function. The entries in the map will be iterated in the same order as the order in which the named parameters were defined. If there were no named parameters declared then the map will be empty.
read-only
normalParameterNames → List<String>
The names of the required positional parameters of this type of function, in the order that the parameters appear.
read-only
normalParameterTypes → List<DartType>
Return a list containing the types of the normal parameters of this type of function. The parameter types are in the same order as they appear in the declaration of the function.
read-only
optionalParameterNames → List<String>
The names of the optional positional parameters of this type of function, in the order that the parameters appear.
read-only
optionalParameterTypes → List<DartType>
Return a map from the names of optional (positional) parameters to the types of the optional parameters of this type of function. The entries in the map will be iterated in the same order as the order in which the optional parameters were defined. If there were no optional parameters declared then the map will be empty.
read-only
parameters → List<ParameterElement>
Return a list containing the parameters elements of this type of function. The parameter types are in the same order as they appear in the declaration of the function.
read-only
returnType DartType
Return the type of object returned by this type of function.
read-only
typeFormals → List<TypeParameterElement>
The formal type parameters of this generic function. For example <T> T -> T. [...]
read-only
displayName → String
Return the name of this type as it should appear when presented to users in contexts such as error messages.
read-only, inherited
element Element
Return the element representing the declaration of this type, or null if the type has not, or cannot, be associated with an element. The former case will occur if the element model is not yet complete; the latter case will occur if this object represents an undefined type.
read-only, inherited
hashCode → int
The hash code for this object.
read-only, inherited
isBottom → bool
Return true if this type represents the bottom type.
read-only, inherited
isDartAsyncFuture → bool
Return true if this type represents the type 'Future' defined in the dart:async library.
read-only, inherited
isDartAsyncFutureOr → bool
Return true if this type represents the type 'FutureOr' defined in the dart:async library.
read-only, inherited
isDartCoreBool → bool
Return true if this type represents the type 'bool' defined in the dart:core library.
read-only, inherited
isDartCoreFunction → bool
Return true if this type represents the type 'Function' defined in the dart:core library.
read-only, inherited
isDartCoreInt → bool
Return true if this type represents the type 'int' defined in the dart:core library.
read-only, inherited
isDartCoreNull → bool
Return true if this type represents the type 'Null' defined in the dart:core library.
read-only, inherited
isDynamic → bool
Return true if this type represents the type 'dynamic'.
read-only, inherited
isObject → bool
Return true if this type represents the type 'Object'.
read-only, inherited
isUndefined → bool
Return true if this type represents a typename that couldn't be resolved.
read-only, inherited
isVoid → bool
Return true if this type represents the type 'void'.
read-only, inherited
name → String
Return the name of this type, or null if the type does not have a name, such as when the type represents the type of an unnamed function.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
typeArguments → List<DartType>
Return a list containing the actual types of the type arguments. If this type's element does not have type parameters, then the array should be empty (although it is possible for type arguments to be erroneously declared). If the element has type parameters and the actual type does not explicitly include argument values, then the type "dynamic" will be automatically provided.
read-only, inherited
typeParameters → List<TypeParameterElement>
Return a list containing all of the type parameters declared for this type.
read-only, inherited

Methods

instantiate(List<DartType> argumentTypes) FunctionType
Return the type resulting from instantiating (replacing) the given argumentTypes for this type's bound type parameters.
override
isSubtypeOf(DartType type) → bool
Return true if this type is a subtype of the given type. [...]
override
substitute2(List<DartType> argumentTypes, List<DartType> parameterTypes) FunctionType
Return the type resulting from substituting the given argumentTypes for the given parameterTypes in this type. The specification defines this operation in section 2: [...]
override
substitute3(List<DartType> argumentTypes) FunctionType
Return the type resulting from substituting the given argumentTypes for this type's parameters. This is fully equivalent to substitute(argumentTypes, getTypeArguments()).
flattenFutures(TypeSystem typeSystem) DartType
Implements the function "flatten" defined in the spec, where T is this type: [...]
inherited
isAssignableTo(DartType type) → bool
Return true if this type is assignable to the given type. A type T may be assigned to a type S, written TS, iff either T <: S or S <: T.
inherited
isEquivalentTo(DartType dest) → bool
Indicates whether this represents a type that is equivalent to dest. [...]
inherited
isMoreSpecificThan(DartType type) → bool
Return true if this type is more specific than the given type.
inherited
isSupertypeOf(DartType type) → bool
Return true if this type is a supertype of the given type. A type S is a supertype of T, written S :> T, iff T is a subtype of S.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
resolveToBound(DartType objectType) DartType
If this type is a TypeParameterType, returns its bound if it has one, or objectType otherwise. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited