streamList method
Stream<List<Map<String, Object?> > >
streamList({
- required StreamListBody body,
- String? authorization,
override
Implementation
@override
Stream<List<Map<String, Object?>>> streamList({
required StreamListBody body,
String? authorization,
}) async* {
final response = await _client.request(
method: 'GET',
path: '/db/stream/list',
headers: {'authorization': authorization},
body: body,
);
final stream = response.transform(utf8.decoder);
yield* stream
.map((event) {
if (jsonDecode(event) case {'data': final List data}) {
return data
.map(
(e) => (e as Map).map(
(key, value) => MapEntry((key as String), value),
),
)
.toList();
}
throw Exception('Invalid response');
})
.handleError((_) {
// do nothing
});
}