the_tuple 0.1.0

SDKdartflutter
Platformandroidioswindowslinuxmacosweb

A tuple constructor for an infinite length of tuple.

The Tuple

An infinite length tuple constructor. TheTuple even supports named tuple elements.

But.... why do you need this package...😅😅? Even I don't need this package!

Limitations

  • Can not provide the type system.
  • Does not support auto-completion.
    • It can be implemented, but I don't have time.

Usage

import 'package:the_tuple/the_tuple.dart';

void main() {
  // You can even add named tuple elements.
  final dynamic myTuple = tuple(0, 1, 2, 3, 4, 5, hi: 'heh', 5);

  print(myTuple);

  // You can access a tuple element by prefixing index with `i`.
  print(myTuple.i0);
  print(myTuple.i1);
  print(myTuple.i2);
  print(myTuple.i3);
  print(myTuple.i4);
  print(myTuple.i5);
  print(myTuple.i6);

  // You can also access a named tuple by its name.
  print(myTuple.hi);

  // The other getters will return `null`.
  print(myTuple.dummy);
  print(myTuple.nothing);
}

Related packages with type/null safety and auto-completion

  • tuple package only supports up to the length of 7.
  • more supports up to 9.
  • dartz supports up to 20.