AnyDistanceFunction typedef Null safety

AnyDistanceFunction = num Function(Never a, Never b)

The type of a union of instances of DistanceFunction<T> for various types T.

This type is used to describe a collection of DistanceFunction<T> functions which have (potentially) unrelated argument types. Since the argument types of the functions may be unrelated, their type is declared as Never, which is the bottom type in dart to which all other types can be assigned to.

Calling an instance of this type must either be done dynamically, or by first casting it to a DistanceFunction<T> for some concrete T.

Implementation

typedef AnyDistanceFunction = num Function(Never a, Never b);