更新时间:2023-02-13 16:17:43
我有一个名为 Reactive-Dart 的库,其中包含许多可组合的运算符,用于终止和非终止序列。对于你的场景,它看起来像这样:
I have a library called Reactive-Dart that contains many composable operators for terminating and non-terminating sequences. For your scenario it would look something like this:
final newList = [];
Observable
.fromList(['abc', 'abc', 'def'])
.distinct()
.observe((next) => newList.add(next), () => print(newList));
产生:
[abc, def]
我应该补充说,类似的功能。在github上检查一下,我相信你会找到一些合适的东西。
I should add that there are other libraries out there with similar features. Check around on github and I'm sure you'll find something suitable.