fromJson static method

ChapterPassage fromJson(
  1. Map<String, Object?> json
)
override

Restores a passage produced by toJson.

Implementation

static ChapterPassage fromJson(Map<String, Object?> json) {
  final end = json['endChapter'];
  if (end != null && end is! int) {
    throw const FormatException('"endChapter" must be an integer or null');
  }
  return ChapterPassage(
    _bookFromJson(json['book']),
    _intFromJson(json, 'startChapter'),
    end as int?,
  );
}