sendQueue static method
sendQueue Sends the queue to the Matomo server. Returns true and clears the queue in case of success.
Implementation
static Future<bool> sendQueue() async {
Map<String, dynamic> bulk = {
"requests": _matomoForever._queue
.map<String>((Map<String, String> m) => "?${m.toQueryString()}")
.toList(),
"token_auth": _matomoForever.tokenAuth,
};
_matomoForever.sendThroughPostMethod ??= _sendThroughPostMethod;
bool ret = await _matomoForever.sendThroughPostMethod!(
_matomoForever.siteUrl!,
jsonEncode(bulk),
headers: _matomoForever.headers,
);
if (ret) {
_matomoForever._queue = [];
}
return (ret);
}