class Allergies { static const List _allergies = [ 'eggs', 'peanuts', 'shellfish', 'strawberries', 'tomatoes', 'chocolate', 'pollen', 'cats', ]; bool allergicTo(final String item, final int allergyScore) => ((allergyScore >> _allergies.indexOf(item)) & 1) == 1; List list(final int allergyScore) => _allergies.where((allergy) => allergicTo(allergy, allergyScore)).toList(); }