addDocument method
Add a document with automatic chunking and embedding.
The document is split into chunks, embedded, and stored.
Note: Indexing is automatic (debounced by 500ms). You generally do NOT need to call rebuildIndex manually, unless you want to ensure the index is ready immediately (e.g., before a UI update).
Implementation
Future<SourceAddResult> addDocument(
String content, {
String? metadata,
String? name,
String? filePath,
ChunkingStrategy? strategy,
Duration? chunkDelay,
void Function(int done, int total)? onProgress,
}) => _engine!.addDocument(
content,
metadata: metadata,
name: name,
filePath: filePath,
strategy: strategy,
chunkDelay: chunkDelay,
onProgress: onProgress,
);