Loading and persistence
DocumentEditorController.fromSource resolves a DocumentSource and then builds the controller. Saving is yours: read controller.document and store its JSON wherever your app keeps data.
dart
import 'package:vyuh_document_editor/vyuh_document_editor.dart';
Future<DocumentEditorController> loadNote(String savedJson) {
return DocumentEditorController.fromSource(
source: DocumentSource.jsonString(savedJson),
extensions: DocumentExtension.richText,
schema: DocumentSchemaPolicy.richText(),
);
}
// Dispose the returned controller when its owning widget is disposed.
// Capture controller.toJsonString() when saving; storage is host-owned.Save a snapshot
controller.document.toJson() (or toJsonString()) is the value to store. Your app owns authentication, storage, autosave and conflicts.
Keep one controller for the editing session and dispose it with its widget.
Replace or stream
replaceDocument starts a new session. When a stream emits, your app decides whether that is a replacement or a collaborative change.
Files and resources
Byte sources take your decoder; URI sources take your loader. Fonts and image bytes are separate resources from the document JSON.