google / tuple.dart

A library providing a tuple data structure
https://pub.dev/packages/tuple
BSD 2-Clause "Simplified" License
194 stars 26 forks source link

Add .cast() methods #11

Closed thosakwe closed 1 year ago

thosakwe commented 5 years ago

Would love to send in a quick PR for this.

Pseudo-code example:

Tuple3 doSomething() native "_doSomething";

void main() {
  var tuple = doSomething.cast<X, Y, Z>(); // Tuple<X, Y, Z>
  // Do something else...
}

class Tuple3 {
  Tuple3<T, U, V> cast<T, U, V>() {
    return Tuple3(item1 as T, item2 as U, item3 as V);
  }
}
devoncarew commented 1 year ago

Thanks fort the issue! However, with the recent release of Dart 3.0 and its support for Records, we plan to move this package into maintenance mode. That would essentially mean not take any enhancements to it and just maintaining it from the POV of bug fixes / CI updates to keep it working.

Some more detail in the related issue: https://github.com/google/tuple.dart/issues/47.