FunctionType class Null safety

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

aliasArguments List<DartType>?
If this type is an instantiation of a type alias, return the type arguments used for the instantiation. Otherwise return null.
read-only, inherited
aliasElement TypeAliasElement?
If this type is an instantiation of a type alias, return it. Otherwise return null.
read-only, inherited
displayName String
Return the name of this type as it should appear when presented to users in contexts such as error messages. [...]
@Deprecated('Use getDisplayString instead'), read-only, inherited
element FunctionTypedElement?
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.
@Deprecated('Use aliasElement instead'), read-only, override
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
isDartCoreDouble bool
Return true if this type represents the type 'double' 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
isDartCoreIterable bool
Returns true if this type represents the type 'Iterable' defined in the dart:core library.
read-only, inherited
isDartCoreList bool
Returns true if this type represents the type 'List' defined in the dart:core library.
read-only, inherited
isDartCoreMap bool
Returns true if this type represents the type 'Map' 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
isDartCoreNum bool
Return true if this type represents the type 'num' defined in the dart:core library.
read-only, inherited
isDartCoreObject bool
Return true if this type represents the type Object defined in the dart:core library.
read-only, inherited
isDartCoreSet bool
Returns true if this type represents the type 'Set' defined in the dart:core library.
read-only, inherited
isDartCoreString bool
Return true if this type represents the type 'String' defined in the dart:core library.
read-only, inherited
isDartCoreSymbol bool
Returns true if this type represents the type 'Symbol' defined in the dart:core library.
read-only, inherited
isDynamic bool
Return true if this type represents the type 'dynamic'.
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.
@Deprecated('Check element, or use getDisplayString()'), read-only, inherited
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
nullabilitySuffix NullabilitySuffix
Return the nullability suffix of this type.
read-only, inherited
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
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
typeArguments List<DartType>
Return the type arguments used to instantiate this type. [...]
@Deprecated('Use aliasArguments instead'), read-only, override
typeFormals List<TypeParameterElement>
The formal type parameters of this generic function. For example <T> T -> T. [...]
read-only

Methods

accept<R>(TypeVisitor<R> visitor) → R
Use the given visitor to visit this type.
inherited
acceptWithArgument<R, A>(TypeVisitorWithArgument<R, A> visitor, A argument) → R
Use the given visitor to visit this type.
inherited
asInstanceOf(ClassElement element) InterfaceType?
Return the canonical interface that this type implements for element, or null if such an interface does not exist. [...]
inherited
getDisplayString({required bool withNullability}) String
Return the presentation of this type as it should appear when presented to users in contexts such as error messages. [...]
inherited
instantiate(List<DartType> argumentTypes) FunctionType
Produces a new function type by substituting type parameters of this function type with the given argumentTypes. The resulting function type will have no type parameters.
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
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited