updatesFor method
- UserId id
override
Listens to the updates of MonetizationSettings for the provided UserId while the returned Stream is listened to.
Implementation
@override
Stream<MonetizationSettings?> updatesFor(UserId id) {
final controller = _updates[id] ??= StreamController.broadcast(
onListen: () async {
Log.debug('updates($id) -> onListen()', '$runtimeType($id)');
await _initMonetizationSubscription(id);
},
onCancel: () {
Log.debug('updates($id) -> onCancel()', '$runtimeType($id)');
_subscriptions.remove(id)?.close(immediate: true);
},
);
_updates[id]?.add(monetization[id]?.value);
return controller.stream;
}