getPendingRequests method
Implementation
@override
Future<List<SyncRequest>> getPendingRequests() async {
if (_db == null) return [];
final List<Map<String, dynamic>> maps = await _db!.query(
'requests',
orderBy: 'createdAt ASC',
);
return maps.map((map) {
return SyncRequest.fromJson({
'id': map['id'],
'method': map['method'],
'url': map['url'],
'headers': map['headers'] != null ? jsonDecode(map['headers'] as String) : null,
'body': map['body'] != null ? jsonDecode(map['body'] as String) : null,
'createdAt': map['createdAt'],
'retryCount': map['retryCount'],
});
}).toList();
}