validAllocation function

bool validAllocation(
  1. Map<String, int> answer,
  2. List<String> items,
  3. int total
)

Implementation

bool validAllocation(Map<String,int> answer,List<String> items,int total)=>answer.length==items.length&&answer.keys.every(items.contains)&&answer.values.every((value)=>value>=0&&value<=total)&&allocationRemaining(total,answer)==0;