streamCount method
Implementation
@override
Stream<int> streamCount({
required StreamCountBody body,
String? authorization,
}) async* {
final response = await _client.request(
method: 'GET',
path: '/db/stream/count',
headers: {'authorization': authorization},
body: body,
);
final stream = response.transform(utf8.decoder);
yield* stream
.map((event) {
if (jsonDecode(event) case {'data': final int data}) {
return data;
}
throw Exception('Invalid response');
})
.handleError((_) {
// do nothing
});
}