Tuple2<T1, T2> class

Tuple2<T1, T2> is a type that contains a value of type T1 and a value of type T2.

Used to avoid creating a custom class that contains two different types or to return two values from one function.

Inheritance
Mixed in types

Constructors

Tuple2(T1 _value1, T2 _value2)
Build a Tuple2 given its first and second values.
const

Properties

first → T1
Get first value inside the Tuple.
no setter
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second → T2
Get second value inside the Tuple.
no setter

Methods

all(bool predicate(T2 a)) bool
Return the result of calling predicate on the second value of the Tuple2.
override
any(bool predicate(T2 a)) bool
Return the result of calling predicate on the second value of the Tuple2.
override
apply<A>(A f(T1 first, T2 second)) → A
Return result of calling f given value1 and value2 from this Tuple.
bimap<C, D>(C mFirst(T1 a), D mSecond(T2 b)) Tuple2<C, D>
Change type of both values of the Tuple.
concatenate(Monoid<T2> monoid) → T2
Combine the second value of Tuple2 using monoid.
override
copyWith({T1? value1, T2? value2}) Tuple2<T1, T2>
Create a copy of this Tuple by changing value1 and/or value2.
duplicate() Tuple2<T1, Tuple2<T1, T2>>
Wrap this Tuple2 inside another Tuple2.
override
extend<Z>(Z f(Tuple2<T1, T2> t)) Tuple2<T1, Z>
Convert the second value of the Tuple2 from T2 to Z using f.
override
extendFirst<Z>(Z f(Tuple2<T1, T2> t)) Tuple2<Z, T2>
Convert the first value of the Tuple2 from T1 to Z using f.
foldLeft<C>(C b, C f(C b, T2 a)) → C
Return value of type C by calling f with b and the second value of the Tuple2.
override
foldLeftFirst<C>(C b, C f(C b, T1 a)) → C
Return value of type C by calling f with b and the first value of the Tuple2.
foldLeftFirstWithIndex<C>(C c, C f(int i, C c, T1 b)) → C
Return value of type C by calling f with b and the first value of the Tuple2.
foldLeftWithIndex<C>(C c, C f(int i, C acc, T2 b)) → C
Return value of type C by calling f with b and the second value of the Tuple2.
override
foldMap<C>(Monoid<C> monoid, C f(T2 a)) → C
Return value of type C by applying f on monoid.
override
foldMapFirst<C>(Monoid<C> monoid, C f(T1 a)) → C
Return value of type C by applying f on monoid.
foldRight<C>(C b, C f(C acc, T2 a)) → C
Return value of type C by calling f with b and the second value of the Tuple2.
override
foldRightFirst<C>(C b, C f(C acc, T1 a)) → C
Return value of type C by calling f with b and the first value of the Tuple2.
foldRightFirstWithIndex<C>(C c, C f(int i, C c, T1 b)) → C
Return value of type C by calling f with b and the first value of the Tuple2.
foldRightWithIndex<C>(C c, C f(int i, C acc, T2 b)) → C
Return value of type C by calling f with b and the second value of the Tuple2.
override
length() int
Returns 1.
override
map<C>(C f(T2 a)) Tuple2<T1, C>
Change type of second value of the Tuple from T2 to C using f.
override
mapBoth<C, D>(Tuple2<C, D> f(T1 first, T2 second)) Tuple2<C, D>
Change type of both values of the Tuple using f.
mapFirst<TN>(TN f(T1 first)) Tuple2<TN, T2>
Change type of first value of the Tuple from T1 to TN using f.
mapSecond<TN>(TN f(T2 second)) Tuple2<T1, TN>
Change type of second value of the Tuple from T2 to TN using f.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
swap() Tuple2<T2, T1>
Swap types T1 and T2 of Tuple2.
toString() String
A string representation of this object.
override

Operators

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