processQueue static method
Implementation
static Future<void>
processQueue() async {
if (_isSyncing) return;
_isSyncing = true;
final requests =
RequestQueue.getAll();
for (final request
in requests) {
try {
await ApiService.request(
method: request.method,
url: request.url,
body: request.body,
headers: request.headers,
);
await RequestQueue.remove(
request.id,
);
SyncLogger.log(
'Synced Request: ${request.id}',
);
} catch (e) {
SyncLogger.log(
'Sync Failed: ${request.id}',
);
}
}
_isSyncing = false;
}