getItem method

Future<Map<String, dynamic>?> getItem({
  1. required String tableName,
  2. String? fieldName = 'id',
  3. required String fieldValue,
})

Implementation

Future<Map<String, dynamic>?> getItem({
  required String tableName,
  String? fieldName = 'id',
  required String fieldValue,
}) async {
  final db = await database;
  final res = await db.query(
    tableName,
    where: '$fieldName = ?',
    whereArgs: [fieldValue],
  );
  return res.isNotEmpty ? _deserializeItem(res.first) : null;
}