events static method

Fetches the events saved in the DB. @returns A Future that completes whit the events retrieved from the DB.

Implementation

static Future<List<MBAutomationEvent>?> events() async {
  Database db = await _database();
  final res = await db.query(
    'event',
    orderBy: 'timestamp ASC',
  );
  if (res.isNotEmpty) {
    return res.map((e) => MBAutomationEvent.fromDbData(dbData: e)).toList();
  }
  return null;
}