我有一个对象列表:
[{name: "Rob", age: 20}, {name: "Bob", age: 30},]
我如何创建一个流和沉?
我到处都找遍了,但没有找到解决办法。
对于String或double或任何其他数据类型,像这样:
final _name = BehaviorSubject<String>();
Stream<String> get name => _name.stream;
Function(String) get changeName => _name.sink.add;
提前感谢!!
根据您的示例代码,您可以像下面这样为map列表设置流和接收器:
final _personList = BehaviorSubject<List<Map<String, dynamic>>>();
Stream<List<Map<String, dynamic>>> get name => _name.stream;
Function(List<Map<String, dynamic>>) get changeName => _name.sink.add;