send method
calls remote server to store all these events related to
videoTriggerId
the video id
Implementation
Future<void> send() {
if (_resultEvents.isEmpty) {
return Future.value();
}
var futuresList = <Future<void>>[];
for (var eventlogId in _resultEvents.keys) {
var events = _resultEvents[eventlogId]!;
for (var event in events) {
futuresList.add(_httpClient.post(
Uri.parse('/eventlogs/$eventlogId'),
body: event.toJson(),
));
}
}
return Future.wait(futuresList) //
.then((_) => _resultEvents.clear());
}