readVisitor method

Future<String> readVisitor(
  1. String visitorId,
  2. String nameTable
)

Implementation

Future<String> readVisitor(String visitorId, String nameTable) async {
  // await openDb();
  // Get the records for the tableHits
  List<Map> result = await _visitorDatabase
          ?.rawQuery('SELECT * FROM $nameTable WHERE id = ?', [visitorId]) ??
      [];

  if (result.isNotEmpty) {
    Flagship.logger(Level.INFO,
        "The visitor: $visitorId have already a stored data in cache");
    return jsonEncode(result.last);
  } else {
    Flagship.logger(
        Level.INFO, "The visitor: $visitorId have no data stored in cache");
    return '';
  }
}