Closed Solido closed 4 years ago
Indeed it would great to know if a value is Tuple without having to check each type one by one (is Tuple2, is Tuple3...). It could also a share the common toList
method they all have:
/// Represents a tuple.
abstract class Tuple {
/// Creates a [List] containing the items of this [Tuple].
///
/// The elements are in item order. The list is variable-length
/// if [growable] is true.
List toList({bool growable = false});
}
Looks like tuple is coming directly to dart and this package will go to sleep.
Le lun. 6 avr. 2020 à 11:52, Alexandre Roux notifications@github.com a écrit :
Indeed it would great to know if a value is Tuple without having to check each type one by one (is Tuple2, is Tuple3...). It could also a share the common toList method they all have:
/// Represents a tuple.abstract class Tuple { /// Creates a [List] containing the items of this [Tuple]. /// /// The elements are in item order. The list is variable-length /// if [growable] is true. List toList({bool growable = false}); }
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/tuple/issues/13#issuecomment-609693330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4MWMFYR2MJRSBE3KVNZTRLGQ5RANCNFSM4ITUWV6A .
-- Robbie
Thanks for the information @Solido. Is there any place I could look for more information (current status, planned implementation) as I could not find relevant information so far?
HI @alextekartik This is linked to dart Destructuration feature
It would it very convenient to have a common interface for tuple :
Tuple
So you can store List but add different implementations.
Currently I need to strongly type on Tuple2 but some result got more entries.
This interface
Tuple
can gives you the number of index (arity) and allow access to value by index and an iterator.Thank you !