NewsQuestion.decode constructor

NewsQuestion.decode(
  1. Map<String, dynamic> nav
)

Implementation

factory decode(Map<String, dynamic> nav) {
  final responseType = NewsQuestionAnswerType.values.byId(
    nav.get<int>('genreReponse'),
  );

  return .new(
    label: nav.get('L'),
    id: nav.get('N'),
    place: nav.get('P'),
    rank: nav.get('rang'),
    responseType: responseType,
    title: nav.get('titre'),
    htmlText: nav.get('texte'),
    responseSize: nav.get('tailleReponse'),
    withMaximum: nav.get('avecMaximum'),
    maximumResponseCount: nav.get('nombreReponsesMax'),
    attachments: nav.getLM('listePiecesJointes').mapL((e) => .decode(e)),
    picks: nav.getLM('listeChoix').mapL((e) => .decode(e)),
    answer: .decode(nav.go('reponse'), responseType),
  );
}