duple 1.3.0 copy "duple: ^1.3.0" to clipboard
duple: ^1.3.0 copied to clipboard

Minimal tuple library for Dart.

Duple #

Minimal tuple library for Dart.

Usage #

Simple usage examples as follows. See accompanying tests for more specific examples.

Import duple. #

import 'package:duple/duple.dart';

Empty Tuple #

All EmptyTuples are identical.

main() {
  var emptyTuple = EmptyTuple();
  assert(emptyTuple == EmptyTuple());
}

One-Tuple #

main() {
  var oneTupleWithString = Tuple1<String>('hello world!');
  var oneTupleWithInt = Tuple1<int>(1);
  print("One tuple contains ${oneTupleWithInt.item0}");
}

Two-Tuple #

main() {
  var twoTupleWithSameTypes = Tuple2<int, int>(1, 2);
  var twoTupleWithDifferentTypes = Tuple2<int, String>(1, 'X');
  print("Two tuple contains ${twoTupleWithSameTypes.item0}, "
  " and ${twoTupleWithSameTypes.item1}");
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Minimal tuple library for Dart.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on duple