validMatrix function

bool validMatrix(
  1. Map<String, List<String>> answer,
  2. List<String> rows,
  3. List<String> columns, {
  4. required bool multiple,
  5. required bool required,
})

Implementation

bool validMatrix(Map<String,List<String>> answer,List<String> rows,List<String> columns,{required bool multiple,required bool required})=>answer.isNotEmpty&&(!required||answer.length==rows.length)&&answer.entries.every((entry)=>rows.contains(entry.key)&&(multiple?entry.value.isNotEmpty:entry.value.length==1)&&entry.value.toSet().length==entry.value.length&&entry.value.every(columns.contains));