getAllLogs method

Future<List<Log>> getAllLogs()

fetch all Logs from Database

Implementation

Future<List<Log>> getAllLogs() async {
  final recordSnapshots = await (_flogsStore.find(
    await _db,
  ));

  // Making a List<Log> out of List<RecordSnapshot>
  return recordSnapshots.map((snapshot) {
    final log = Log.fromJson(snapshot.value);
    // An ID is a key of a record from the database.
    log.id = snapshot.key;
    return log;
  }).toList();
}