Story constructor

Story({
  1. required String title,
  2. required String description,
  3. required String authors,
  4. required Page root,
  5. required Page currentPage,
  6. List<HistoryItem>? existingHistory,
  7. required int year,
  8. ImageResolver? imageResolver,
})

Implementation

Story(
    {required this.title,
    required this.description,
    required this.authors,
    required this.root,
    required this.currentPage,
    List<HistoryItem>? existingHistory,
    required this.year,
    this.imageResolver}) {
  history = existingHistory ?? List.empty(growable: true);
  imageResolver ??= BackgroundImage.getRandomImageForType;

  historyChanges = _streamHistory.stream;
  // if the Story was just opened then add the very first node from current page to the history.
  if (history.isEmpty) {
    _logCurrentPassageToHistory();
  }
}