VerseRef class
A reference to a single Bible verse.
This class represents a specific verse location with a book, chapter, and verse number. Instances are immutable and thread-safe.
Example:
final verse = VerseRef.parse("John 3:16");
print(verse.book.fullName); // "John"
print(verse.chapter); // 3
print(verse.verse); // 16
print(verse.displayString); // "John 3:16"
- Inheritance
- Implemented types
- Available extensions
Constructors
- VerseRef({required BibleBookEnum book, required int chapter, required int verse, String? subdivision})
-
const
- VerseRef.checked({required BibleBookEnum book, required int chapter, required int verse, String? subdivision})
-
Creates a reference while enforcing broad numeric sanity limits.
factory
Properties
- book → BibleBookEnum
-
The Bible book containing this verse.
final
- chapter → int
-
The chapter number (1-based).
final
- displayString → String
-
Returns a human-readable string representation of this reference.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setteroverride
- osisIdentifier → String
-
Available on Reference, provided by the ReferenceMachineIdentifiers extension
Encodes this reference as an OSIS identifier.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subdivision → String?
-
An optional verse subdivision, represented by one lowercase letter a-z.
final
- usfmIdentifier → String
-
Available on Reference, provided by the ReferenceMachineIdentifiers extension
Encodes this reference as a USFM machine-readable reference.no setter - verse → int
-
The verse number within the chapter (1-based).
final
- verseLabel → String
-
The verse number with its subdivision, such as
5or5a.no setter
Methods
-
compareTo(
VerseRef other) → int -
Orders by book, chapter, verse, then subdivision (
5 < 5a < 5b < 6). This is an ordering of identifiers, not a test of text containment.override -
copyWith(
{BibleBookEnum? book, int? chapter, int? verse, String? subdivision, bool clearSubdivision = false}) → VerseRef -
Copies this verse, retaining its subdivision unless
clearSubdivisionis true or a replacementsubdivisionis supplied. -
format(
{BibleLanguageEnum language = BibleLanguageEnum.english, ReferenceBookNameStyle bookNameStyle = ReferenceBookNameStyle.long, bool compactRanges = true}) → String -
Available on Reference, provided by the LocalizedReferenceFormatting extension
Formats this reference with localized long or short book names. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
Converts this reference to a stable JSON-compatible map.
override
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
fromJson(
Map< String, Object?> json) → VerseRef -
Restores a verse reference produced by toJson.
override
-
parse(
String ref, {BibleLanguageEnum? language}) → VerseRef -
Parses a string into a single verse reference.
override
-
parseResult(
String ref, {BibleLanguageEnum? language}) → ParseResult< VerseRef> -
Parses
refinto an explicit success or failure value.override -
tryParse(
String ref, {BibleLanguageEnum? language}) → VerseRef? -
Parses
ref, returningnullinstead of throwing for invalid input.override