Chunk class final

A piece of a source text with its exact position in that source.

The offsets refer to the original string passed to Chunker.chunk, so source.substring(chunk.start, chunk.end) always equals text. This makes it possible to highlight retrieved passages in the source document.

Constructors

Chunk({required String text, required int start, required int end, Map<String, Object?> metadata = const {}})
Creates a chunk covering [start, end) in the source text.

Properties

end int
Offset in the source text where this chunk ends, exclusive.
final
hashCode int
The hash code for this object.
no setteroverride
metadata Map<String, Object?>
Extra information attached by the chunker. Empty for the built-in chunkers.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start int
Offset in the source text where this chunk starts, inclusive.
final
text String
The chunk content.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
Two chunks are equal when they carry the same text, cover the same range, and have equal metadata.
override