Callable2<R, V1, V2> class abstract

An abstraction for callbacks with two parameters in the form of a class to easily implement value semantics.

Can be assigned to Widget callback properties with two parameters, e.g. LocaleResolutionCallback.

When the constructor parameters for a widget change, it usually needs to be rebuilt. If the properties in the state of a stateful widget change, the build method of the state must be re-executed. Here, change usually means value semantics. Many constructor parameters or state properties are callbacks in the form of methods, often implemented as function expressions. Function expressions have no value semantics in Dart. With classes by suitable rewriting of hashCode and operator== value semantics are easily achieved. To achieve value semantics, classes rather than methods should be used for callbacks.

The type parameter R defines the return type of the call method. The type parameter V1 defines the type of the 1st parameter of the call method. The type parameter V2 defines the type of the 2nd parameter of the call method.

Implementers

Constructors

Callable2()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(V1 value1, V2 value2) → R
Allows to use this class like a method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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