getTotalHits method
Implementation
String getTotalHits([String? key]) {
var request = 0;
var response = 0;
var init = 0;
var listen = 0;
if (key != null && key.isNotEmpty) {
request = getRequestedHits(key);
response = getResponseHits(key);
init = getInitialHits(key);
listen = getListeningHits(key);
} else {
for (var i in logs.entries) {
if (i.key.contains(HitType.request.name)) {
request = request + i.value;
} else if (i.key.contains(HitType.response.name)) {
response = response + i.value;
} else if (i.key.contains(HitType.init.name)) {
init = init + i.value;
} else if (i.key.contains(HitType.listen.name)) {
listen = listen + i.value;
}
}
}
return "$name {\n"
"-> ${HitType.init.name} : $init\n"
"-> ${HitType.listen.name} : $listen\n"
"-> ${HitType.request.name} : $request\n"
"-> ${HitType.response.name} : $response\n"
"}";
}