google / tuple.dart

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

Whats the point of Tuple always being 'const'? #6

Closed brettclutch closed 5 years ago

brettclutch commented 5 years ago

Maybe I'm missing something but I can't pair a with an runtime object as one of the pairs of the tuple since the Tuple2 constructor is const. This completely misses the point then of why you would use a Tuple in the first place. Am I missing something?

e.g.

class Dog { String name; }

enum Action { Walk, Wash, Play, Feed }

void main() { var myDog = new Dog(); var myFancyTuple = Tuple2<Dog, Action>(myDog, Action.Feed); <- Invalid since class myDog is not a const. }

brettclutch commented 5 years ago

BS on my end, a Flutter component above was CONST. I saw the CONST in the source on the constructor and thought it was the issue.