flatten abstract method

DartType flatten(
  1. DartType type
)

Return the result of applying the function "flatten" to the given type.

For the Dart 2.0 type system, the function is defined in the Dart Language Specification, section 16.11 Function Expressions:

We define the auxiliary function flatten(T), which is used below and in other sections, as follows:

  • If T is FutureOr<S> for some S then flatten(T) = S.

  • Otherwise if T <: Future then let S be a type such that T <: Future<S> and for all R, if T <: Future<R> then S <: R. This ensures that Future<S> is the most specific generic instantiation of Future that is a supertype of T. Note that S is well-defined because of the requirements on superinterfaces. Then flatten(T) = S.

  • In any other circumstance, flatten(T) = T.

The subtype relationship (<:) can be tested using isSubtypeOf.

Other type systems may define this operation differently.

Implementation

DartType flatten(DartType type);