ChapterPassage constructor

ChapterPassage(
  1. BibleBookEnum book,
  2. int startChapter, [
  3. int? endChapter
])

Implementation

factory ChapterPassage(
  BibleBookEnum book,
  int startChapter, [
  int? endChapter,
]) {
  _validateReferenceNumber(
    startChapter,
    component: 'startChapter',
    maximum: maxReferenceChapterNumber,
  );
  if (endChapter != null) {
    _validateReferenceNumber(
      endChapter,
      component: 'endChapter',
      maximum: maxReferenceChapterNumber,
    );
    if (endChapter <= startChapter) {
      throw ArgumentError.value(
        endChapter,
        'endChapter',
        'must come after startChapter',
      );
    }
  }
  return ChapterPassage._(book, startChapter, endChapter);
}