random method
Implementation
Future<List<ISQLiteItem>> random(ISQLiteItem item, int count) async {
final db = await getOpenDatabase();
final tableName = item.getTableName();
// Query the table and order by random, limit by the given count
final List<Map<String, dynamic>> results = await db.rawQuery(
'SELECT * FROM $tableName ORDER BY RANDOM() LIMIT ?',
[count], // Use parameterized queries to avoid SQL injection
);
// Convert the query results into a list of ISQLiteItem objects
final List<ISQLiteItem> items =
results.map((map) => item.fromMap(map)).toList();
return items;
}