getLogs method

Future<List<LogModel>> getLogs()

Implementation

Future<List<LogModel>> getLogs() async {
  try {
    final logs = await _sqfLiteService.get(orderBy: "timestamp DESC");
    return List.from(logs).map((log) => LogModel.fromJson(log)).toList();
  } catch (e) {
    if (e.toString().isCaseInsensitiveContainsAny("Database is not initialized")) {
      debugPrint("🫥 Please enable API client logger while initializing the ApiClient.");
    } else {
      debugPrint("$e");
    }
    return [];
  }
}