Skip to content

API Reference

High-use public APIs exported by package:docx_editor/docx_editor.dart.

Use this page as the package-level API map. The root reviewer pages cover architecture, configuration, and rendering/conversion.

Editor Session

APIPurpose
SyncfusionDocxEditorFlutter widget hosting Syncfusion DocumentEditor.
DocxControllerSession controller for save, export, review, sign, audit, locks, lifecycle, dirty state, and capabilities.
DocxCapabilitiesCapability presets, document-grant mapping, JSON conversion, and action gates.
DocumentGrantHost-facing read, review, and edit access grants.
DocxCapability / DocxModeInternal action flags and resolved editor modes.
DocxEditLockSingle-editor lock state.
DocxActorAuthenticated user attribution. Required for signing.
DocxLifecycleStateDraft, review, approved, effective, and superseded lifecycle states.
DocxLifecycleBindingResolves lifecycle and requested capabilities into an allowed session mode.
DocxPickedDocumentResolved document passed into the editor.
DocxSource / DocxSourceKindDOCX/SFDT/storage-reference source variants.
DocxSyncfusionConfigSyncfusion license, service URL, CDN, toolbar mode, and trusted origin.
DocxAuditEvent / DocxAuditEventTypeTyped audit events emitted by the controller.

Public Export Groups

package:docx_editor/docx_editor.dart exports these groups:

Export groupPublic surface
src/docx_api.dartSession, source, capabilities, lifecycle, lock, storage, review, revision, signing, conversion, picker, and error APIs.
src/widgets/syncfusion_docx_editor.dartMain editor widget.
src/widgets/docx_review_view.dartUnified redline, comment, and suggestion review surface.
src/widgets/docx_review_panel.dartComment-thread panel.
src/widgets/docx_compare_view.dartRedline compare view.
src/controlled_print/*Controlled print service, request/result types, host interfaces, and errors.

Controller Constructor

dart
final controller = DocxController(
  capabilities: capabilities,
  storageAdapter: storageAdapter,
  trustedClock: trustedClock,
  actor: actor,
  lifecycleState: lifecycleState,
  requireResolvedCommentsForSign: true,
  signingVocabulary: signingVocabulary,
  onAuditEvent: auditSink.write,
);
ParameterMeaning
capabilitiesWhat this actor may do in this document session.
storageAdapterHost contract for loading, saving drafts, creating versions, and download URLs.
trustedClockBackend-authoritative UTC time.
onAuditEventCallback for durable audit persistence.
actorOptional for view/edit, required for sign(). Also used as Syncfusion author metadata.
lifecycleStateOptional lifecycle guard. Released states cannot receive editable presets.
requireResolvedCommentsForSignBlocks signing while open review threads remain.
signingVocabularyAllowed controlled meanings for electronic signatures.

Controller Operations

OperationPurposeGate
updateCapabilitiesReplace session capabilities after host access changes.Lifecycle guard.
attachFileGatewayAttach the live editor bridge.Internal widget wiring.
updateEditLockApply host lock state.Required for locked edit sessions.
updateCurrentPayloadReplace cached SFDT/DOCX/PDF payloads.Host/editor synchronization.
recordOpenedEmit open audit after a document opens.open.
saveDraftSave mutable draft content.save, lifecycle, lock.
createVersionCreate a versioned save.save, lifecycle, lock.
getDownloadUrlAsk host storage for a download URL.download capability.
exportCurrentFileExport current SFDT, DOCX, or PDF.format-specific capability.
addCommentAdd a comment at the current editor selection.comment.
listRevisionsRead tracked-change summaries.viewTrackChanges.
listCommentsRead review threads.showComments.
refreshReviewStateRecount unresolved threads.showComments.
addReplyAppend a reply to a thread.comment.
resolveComment / reopenCommentUpdate comment thread state.comment.
goToCommentNavigate the editor to a comment anchor.showComments.
acceptFirstRevision / acceptRevisionByIdAccept tracked changes.acceptRevisions, lifecycle, lock.
rejectFirstRevision / rejectRevisionByIdReject tracked changes.rejectRevisions, lifecycle, lock.
applySuggestion / rejectSuggestionMap a suggestion to revision accept/reject.revision gates.
printFileAsk the live editor to print.print.
signRecord an electronic signature.eSign, actor, reauth, vocabulary, optional resolved-comments gate.

Capability Presets

APIPurpose
DocxCapabilities.fromGrants(grants)Preferred host-facing API. Expands DocumentGrant.read, review, and edit into internal editor action gates.
DocxCapabilities.viewOnly()Open and search/read.
DocxCapabilities.commentOnly()Add comments and view review state.
DocxCapabilities.revisionReview()Accept/reject tracked changes and review comments.
DocxCapabilities.fullEdit()Standard authoring, optional required track changes.
DocxCapabilities.editWithLock()Full authoring with mandatory current-session edit lock.
DocxCapabilities.fromJson / tryFromJsonParse serialized capabilities.

DocxCapability.eSign is deliberately not included in authoring presets. Add it only for a sign-off lifecycle step.

Source and Picked Document APIs

APIPurpose
DocxSource.docxBase64Open a DOCX payload already encoded as base64.
DocxSource.docxBytesOpen DOCX bytes.
DocxSource.sfdtStringOpen SFDT JSON text.
DocxSource.sfdtJsonOpen a decoded SFDT map.
DocxSource.blankDocumentOpen a new blank SFDT document with a valid paragraph anchor.
DocxSource.storageReferenceOpen a host storage reference through the storage adapter.
DocxPickedDocument.localBytesLocal .docx pick with optional source identity, lock, hash, and metadata.
DocxPickedDocument.networkBytesNetwork-loaded .docx pick with URL metadata.
DocxPickedDocument.serverDocumentHost document record with source id, optional version id, lock, hash, and capabilities.
DocxPickedDocument.verifyIntegrityValidate direct byte payloads against a host SHA-256 before opening.

Lifecycle and Lock APIs

APIPurpose
DocxLifecycleState.draftEditable authoring state.
DocxLifecycleState.inReviewReview state; default resolver returns revision review access.
DocxLifecycleState.approvedReleased read-only state.
DocxLifecycleState.effectiveReleased read-only state.
DocxLifecycleState.supersededReleased read-only state.
DocxLifecycleBinding.resolveConverts lifecycle plus requested capabilities into the allowed session preset.
DocxLifecycleBinding.wouldBeEditableDetects illegal editable access in released states.
DocxEditLock.notRequiredSession does not need a single-editor lock.
DocxEditLock.ownedByCurrentSessionCurrent session owns the lock and may mutate.
DocxEditLock.ownedByOtherAnother session owns the lock; mutation must be blocked.

Host Contracts

APIPurpose
DocxStorageAdapterOpen, save draft, create version, and get download URL.
DocxOpenRequest / DocxLoadResultLoad request and result objects.
DocxSaveRequest / DocxSaveResultSave request and result objects.
DocxDownloadRequestDownload/export request metadata.
DocxTrustedClockServer-authoritative UTC time.
DocxCredentialVerifierRe-authenticate actor for e-signing.
DocxReauthChallenge / DocxReauthResultRe-authentication ceremony data.
DocxIntegrity helpersContent hash and integrity checks.

Storage Contract Methods

MethodResponsibility
open(DocxOpenRequest)Resolve a storage reference into a load result.
saveDraft(DocxSaveRequest)Persist a mutable draft save.
createVersion(DocxSaveRequest)Persist an immutable or versioned save.
getDownloadUrl(DocxDownloadRequest)Return a host download URL when available.

Review and Signature

APIPurpose
DocxReviewThreadComment/review thread data.
DocxReviewCommentIndividual review comment.
DocxThreadStatusReview thread lifecycle.
DocxRevisionSummaryTracked-change summary.
DocxSuggestionHigher-level suggestion over one or more revisions.
DocxSuggestionStatusSuggestion lifecycle.
DocxSignatureRequestE-sign request.
DocxSignatureResultE-sign result.
DocxSigningVocabularyAllowed signature meanings.

Widget APIs

WidgetConstructor inputsPurpose
SyncfusionDocxEditordocument, syncfusionConfig, optional controller, conversionService, sizing, toolbar, callbacksMain editor surface.
DocxCompareViewDocxDiffResult or base/revised DocxBuiltDocuments, title, initial modeReviewer redline.
DocxReviewPanelThreads, current actor id, reply/status/navigation/create/refresh callbacksComment thread workflow panel.
DocxReviewViewDiff or base/revised documents, threads, suggestions, navigation/comment/suggestion callbacksUnified review surface combining redline, comments, and suggestions.

Review Widgets

APIPurpose
DocxReviewViewReview-side panel for tracked changes and threads.
DocxReviewPanelComment-thread review panel.
DocxCompareView / DocxCompareModeSide-by-side and inline comparison UI.

Controlled Print

APIPurpose
ControlledPrintServiceIssues controlled/uncontrolled copies.
ControlledPrintRequestSource document and issuance metadata.
ControlledPrintResultIssued PDF bytes, copy number, hash, renderer ID, issue time.
PrintActorActor attribution for print issuance.
SignatureManifestEntrySignature evidence included in controlled copies.
CopyClasscontrolled or uncontrolled watermark class.
PrintPolicyHost authorization check.
PrintAuthorizationAuthorization decision.
CopyAllocatorAtomic copy-number and issuance-code allocation.
CopyAllocationAllocated copy number and issuance code.
TrustedClockServer-authoritative UTC issue time.
PrintRegisterRegister row persistence.
IssuanceRecordRegister row payload.
AuditSinkImmutable print audit event persistence.
PrintAuditEvent / PrintAuditActionControlled-print audit payload.
ControlledPrintException subclassesTyped failure modes such as denial, missing furniture, and content mismatch.

Conversion and Rendering

APIPurpose
DocxConversionServiceConversion interface.
DocxImportRequest / DocxImportResultDOCX import to SFDT.
DocxExportRequest / DocxConversionResultDOCX/PDF export payloads.
DocxConversionFormatSupported export formats.
VyuhDocxConversionServicePure-Dart conversion backed by vyuh_docx.
DocxConverterHigh-level conversion facade.
DocxConversionError subclassesTyped conversion failures.

Picking

APIPurpose
DocxPickerServiceOpens local, network, or server-backed documents.
DocxPickerModePicker behavior mode.
DocxPickKindPicked document source kind.

Errors

APIPurpose
DocxError subclassesInvalid source, permission, service, reauth, lifecycle, comments, and integrity failures.

Common Snippets

dart
final capabilities = DocxCapabilities.fromGrants(
  const {DocumentGrant.read, DocumentGrant.review, DocumentGrant.edit},
  singleEditorLockRequired: true,
);
dart
final service = ControlledPrintService(
  policy: policy,
  allocator: allocator,
  clock: clock,
  register: register,
  audit: audit,
);