FunctionType class abstract

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

alias InstantiatedTypeAliasElement?
If this type is an instantiation of a type alias, information about the alias element, and the type arguments. Otherwise return null.
no setterinherited
element Null
Return the element representing the declaration of this type, or null if the type is not associated with an element.
no setteroverride
element2 Null
Return the element representing the declaration of this type, or null if the type is not associated with an element.
no setteroverride
extensionTypeErasure DartType
The extension type erasure of this type.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isBottom bool
Return true if this type represents the bottom type.
no setterinherited
isDartAsyncFuture bool
Return true if this type represents the type 'Future' defined in the dart:async library.
no setterinherited
isDartAsyncFutureOr bool
Return true if this type represents the type 'FutureOr
no setterinherited
isDartAsyncStream bool
Return true if this type represents the type 'Stream' defined in the dart:async library.
no setterinherited
isDartCoreBool bool
Return true if this type represents the type 'bool' defined in the dart:core library.
no setterinherited
isDartCoreDouble bool
Return true if this type represents the type 'double' defined in the dart:core library.
no setterinherited
isDartCoreEnum bool
Return true if this type represents the type 'Enum' defined in the dart:core library.
no setterinherited
isDartCoreFunction bool
Return true if this type represents the type 'Function' defined in the dart:core library.
no setterinherited
isDartCoreInt bool
Return true if this type represents the type 'int' defined in the dart:core library.
no setterinherited
isDartCoreIterable bool
Returns true if this type represents the type 'Iterable' defined in the dart:core library.
no setterinherited
isDartCoreList bool
Returns true if this type represents the type 'List' defined in the dart:core library.
no setterinherited
isDartCoreMap bool
Returns true if this type represents the type 'Map' defined in the dart:core library.
no setterinherited
isDartCoreNull bool
Return true if this type represents the type 'Null' defined in the dart:core library.
no setterinherited
isDartCoreNum bool
Return true if this type represents the type 'num' defined in the dart:core library.
no setterinherited
isDartCoreObject bool
Return true if this type represents the type Object defined in the dart:core library.
no setterinherited
isDartCoreRecord bool
Return true if this type represents the type 'Record' defined in the dart:core library.
no setterinherited
isDartCoreSet bool
Returns true if this type represents the type 'Set' defined in the dart:core library.
no setterinherited
isDartCoreString bool
Return true if this type represents the type 'String' defined in the dart:core library.
no setterinherited
isDartCoreSymbol bool
Returns true if this type represents the type 'Symbol' defined in the dart:core library.
no setterinherited
isDartCoreType bool
Return true if this type represents the type 'Type' defined in the dart:core library.
no setterinherited
isDynamic bool
Return true if this type represents the type 'dynamic'.
no setterinherited
isVoid bool
Return true if this type represents the type 'void'.
no setterinherited
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.
no setterinherited
namedParameterTypes Map<String, DartType>
A map from the names of named parameters to the types of the named parameters of this type of function.
no setter
normalParameterNames List<String>
The names of the required positional parameters of this type of function, not necessarily in the order that the parameters appear.
no setter
normalParameterTypes List<DartType>
A list containing the types of the normal parameters of this type of function.
no setter
nullabilitySuffix NullabilitySuffix
Return the nullability suffix of this type.
no setterinherited
optionalParameterNames List<String>
The names of the optional positional parameters of this type of function, not necessarily in the order that the parameters appear.
no setter
optionalParameterTypes List<DartType>
A map from the names of optional (positional) parameters to the types of the optional parameters of this type of function.
no setter
parameters List<ParameterElement>
A list containing the parameters elements of this type of function.
no setter
returnType DartType
The type of object returned by this type of function.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
typeFormals List<TypeParameterElement>
The formal type parameters of this generic function; for example, <T> T -> T.
no setter

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(InterfaceElement element) InterfaceType?
Return the canonical interface that this type implements for element, or null if such an interface does not exist.
inherited
getDisplayString({bool withNullability = true}) 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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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