getItem method Null safety

Future<Map<String, dynamic>?> getItem(
  1. String table,
  2. String id
)

Gets an item from the database table with id indicated

Implementation

Future<Map<String, dynamic>?> getItem(String table, String id) async {
  await ensureDbOpen();
  final result = await db.query(table, where: 'id = ?', whereArgs: [id]);
  return result.isNotEmpty ? result.first : null;
}