routedAnswers function

Map<String, dynamic> routedAnswers(
  1. Collection collection,
  2. Map<String, dynamic> answers
)

Implementation

Map<String,dynamic> routedAnswers(Collection collection,Map<String,dynamic> answers){var result=visibleAnswers(collection.questions,answers);final all=_pages(collection);for(var pass=0;pass<=collection.questions.length;pass++){final reached=pageRoute(collection,result).expand((i)=>all[i].questionIds).toSet();final filtered=visibleAnswers(collection.questions,Map.fromEntries(result.entries.where((entry)=>reached.contains(entry.key))));if(filtered.length==result.length)return filtered;result=filtered;}throw const FormatException('Survey route did not stabilize');}