getAllCardState method Null safety

List<DRCard> getAllCardState()

Implementation

List<DRCard> getAllCardState() {
  return _state!.cardStates.values.map((cardState) {
    final frontField = cardState!.combination!.front!
        .map((int i) => _masters[cardState.master]!.fields![i])
        .toList();
    final backFields = cardState.combination!.back!
        .map((int i) => _masters[cardState.master]!.fields![i])
        .toList();

    final dueDate = calculateDueDate(cardState);
    final card = DRCard(
        master: cardState.master,
        combination: cardState.combination,
        front: frontField,
        back: backFields,
        lastReviewed: cardState.lastReviewed,
        dueDate: dueDate);

    return card;
  }).toList();
}