Closed JaffaKetchup closed 1 year ago
While we are here-
In the world of records, is there an actual convenient alternative to withItemN
methods?
E.g.
Or is there any way to write equivalent utility functions for records?
Hey, it's the nightly.link guy :D
Turns out, you are quite right. Records are immutable, and there's no built in way to copy them or iterate through their elements - you'd need something like (original.$1, 'new', original.$2)
. Can't even use the spread operator.
I hadn't used them myself yet, but would've assumed they'd have a few more functions than they do.
Maybe that in itself is enough reason for Tuples to keep existing.
With the release of Dart 3.0 comes records. This pretty much does the same as this package, but has more advantages as it is more closely tied in with the other features of the language.
Is this package necessary anymore?