toReference method

Reference toReference({
  1. required BibleBookEnum book,
  2. required int chapter,
})

Creates the location covered by this entry in book and chapter.

Returns a VerseRangeRef for a combined label and a VerseRef otherwise. The returned reference uses normalized spelling. Retain this VerseLabel alongside the text entry to preserve its original source label.

Implementation

Reference toReference({required BibleBookEnum book, required int chapter}) {
  final start = VerseRef.checked(
    book: book,
    chapter: chapter,
    verse: startVerse,
    subdivision: startSubdivision,
  );
  final lastVerse = endVerse;
  if (lastVerse == null) return start;
  return VerseRangeRef.checked(
    start: start,
    end: VerseRef.checked(
      book: book,
      chapter: chapter,
      verse: lastVerse,
      subdivision: endSubdivision,
    ),
  );
}