nutrient_flutter_web 2.1.0
nutrient_flutter_web: ^2.1.0 copied to clipboard
Web implementation of the nutrient_flutter plugin.
2.1.0 19 Nov 2026 #
- Adds an
onDocumentLoadFailedcallback toNutrientViewWeb, invoked whenNutrientViewer.load()rejects or the document source cannot be resolved, and emits the failure as aDocumentErrorEventon theeventsstream. Both cases were previously logged to the console and otherwise dropped, leaving an empty viewer. A document URL the server answers with an error page, such as a 404, isn't reported: the Web SDK opens the error page as a document. (L#HYB-1050) - Regenerates the
dart:js_interopbindings from Web SDK 1.24.0's TypeScript declarations, so APIs added since 1.17.0 are reachable through them. Code that uses the bindings directly may need changes. The Web SDK's static functions are static methods ofNutrientViewer, for exampleNutrientViewer.load(configuration); the top-levelload,unload,convertToPDFand others they replace looked up globals the Web SDK doesn't define. Constants such asAutoSaveModeandI18nare static members ofNutrientViewertoo, and their top-level getters now read those members instead of such globals. Namespace members are no longer also emitted with a namespace prefix: useRect,InkAnnotationorTextFormFieldrather thanGeometry_Rect,Annotations_InkAnnotationorFormFields_TextFormField, and numbered duplicates such asInkAnnotationJSON$3are gone. Names the Web SDK changed since 1.17.0 follow it:IRect,IDrawingPointand theI*Actioninterfaces are now*CtorPropsand*Datatypes,IRectJSONisRectJSON,MeasurementScaleJSONisIMeasurementScaleJSON, theInterfacestype is gone, and the model classes no longer have a staticdefaultValues.Instance.applyOperationsandexportPDFWithOperationstake aJSArray<DocumentOperationsUnion>, andsetLocaletakes aString.package:nutrient_flutter_web/nutrient_flutter_web.dartno longer exports the bindings'LocaleandAlignment, which clash with Flutter's; importpackage:nutrient_flutter_web/nutrient_web_bindings.dartwith a prefix for the full bindings. (L#HYB-1126) - Updates to Nutrient Web SDK 1.24.0. Since Web SDK 1.23.0,
save()throws when Document Engine refuses a change, where the Web SDK used to log a console warning and report the save as done. (L#HYB-1127) - Fixes calls through function-typed values in the
dart:js_interopbindings, such asI18n.preloadLocalizationData('fr'), reaching JavaScript with their first argument asthisand the remaining arguments shifted. (#61033) - Fixes
NutrientViewWebsometimes staying blank withPSPDFKitError: The mounting container has no width.in the console. It calledNutrientViewer.load()a fixed 100 ms after creating its container, which wasn't always enough for Flutter to lay the container out, for example during a route transition or in a background tab. It now loads once the container is attached and has a size; a background tab waits until it's shown. If the container still has no size after 10 seconds on screen,onDocumentLoadFailedsays so, and the view loads once the container gets one. Also fixes a view disposed while its document was loading keeping the loaded instance. (L#HYB-1122) - Fixes
AnnotationSelectedEventandAnnotationDeselectedEventnever carrying the selected annotations. They were built from the Web SDK'sannotations.focusandannotations.blur, whose payload is a focus event rather than annotations. They now come fromannotationSelection.change, as on Android:AnnotationDeselectedEventfor the annotations that leave the selection, as they are when they leave it, thenAnnotationSelectedEventfor the ones that join it. The selection is reported deselected when the view unloads its document, when another document loads, and when the adapter is disposed.annotations.focusandannotations.blurstill reachwebEventswith their payload, andannotationSelection.changenow does too instead ofnull. (L#HYB-1124) - Fixes
getAnnotationPropertiesreporting nostrokeColorfor notes, text markup, stamps, redactions and free text, andsaveAnnotationPropertiesdropping astrokeColorchange on them, or throwing on free text:strokeColornow reads and writes theircolor, which on a redaction is the overlay text colour, and free text'sfontColor, as on Android and iOS. (L#HYB-1131) - Fixes
getAnnotationPropertiesalways reporting nocontents, andsaveAnnotationPropertiesfailing with'text' is not an object with properties 'format' and 'value'whencontentsis set.contentsnow reads and writes the text of notes and free text annotations. Rich free text is read without its markup, and saving new contents to it keeps its text colour but drops other formatting. (L#HYB-1128) - Fixes a
documentPaththat names a Flutter asset, such asassets/document.pdf, failing to load on web once the app is deployed: the viewer showed the server's 404 page, because Flutter serves assets under an extraassets/directory and the app's base href. Asset paths now load from the URL Flutter serves them at, inNutrientView,NutrientDocumentViewand headlessopenDocument(); other paths still go to the Web SDK as they are. (L#HYB-1123)
2.0.0 29 Jul 2026 #
- Implements
NutrientDocumentInterface.getPageInfoon web viaInstance.pageInfoForIndex, returningPageInfowith width, height (pixels at 100% zoom), rotation (degrees), and label. (J#HYB-951) - Fixes
BookmarkOperations.removeBookmarkraisingPSPDFKitError: No object with id '<name>' foundon the legacy "match by name" fallback. The Web SDK'sinstance.delete(...)only resolves bookmarks by their SDK-assignedpdfBookmarkIdor by passing the liveImmutable.Recorditself — the name string is not a valid id. We now keep matching bypdfBookmarkId/name/ page index but always hand the matched live record todelete(...), sincepdfBookmarkIdis not surfaced on freshly-created (unpersisted) bookmarks either. (J#HYB-951) - Implements seven view-scoped methods on
NutrientWebAdapter.zoomToRect,getZoomScale,enterAnnotationCreationMode, andexitAnnotationCreationModehave full JS-interop implementations;getVisibleRect,convertViewPointToPdfPoint, andconvertPdfPointToViewPointthrowUnimplementedError(the Web SDK does not expose these at this layer), matching the legacy web controller. (J#HYB-952) - Adds
utils/annotation_tool_web_mapping.dartwithwebInteractionModeForandannotationPresetForTextMarkupToolhelpers, replacing the legacyAnnotationToolWebExtensionlookups so the web adapter no longer depends on pigeon-generated enums. (J#HYB-952) - Wires
NutrientWebAdapterto drive the cross-platformeventsstream from the Web SDK'sinstance.addEventListener(...). Cross-platform events fire fromannotations.create/update/delete/focus/blur,viewState.currentPageIndex.change,page.press,textSelection.change,formFieldValues.update, anddocument.saveStateChange.DocumentLoadedEventis emitted synchronously at the end ofonInstanceLoadedsince the Web SDK delivers a fully-loaded instance up front. (J#HYB-957) - Adds
NutrientWebEventData(type, payload)carrier and awebEventsbroadcast stream onNutrientWebAdapterthat mirrors all 73 events from the Web SDK'sNutrientViewer.EventNameenum (sourced canonically fromweb/web/src/enums/EventName.tsin the monorepo). Web-only events are registered with 0-arg JS callbacks because the Web SDK fires events with varying arity (0, 1, or 2 args) and Dart's.toJSenforces exact arity — a 1-arg listener crashes on annotation-save events that fire with no payload. (J#HYB-957) - Updates to Nutrient Web SDK 1.17.0 and regenerates the
dart:js_interopbindings from its TypeScript declarations.
1.1.0 09 Apr 2026 #
- Fixes
baseUrlnot being applied from the user's configuration before the firstNutrientViewer.load()call, which caused an assertion error on subsequent loads. (J#HYB-910) - Adds
WebConfigurationBuilderto convertNutrientViewConfigurationinto the Nutrient Web SDK configuration object. (J#HYB-988)
1.0.0 13 Feb 2026 #
- Initial release as standalone pub.dev package.
- Web platform bindings using
dart:js_interopandpackage:webfor Nutrient Web SDK integration. - Provides platform adapter to extend
nutrient_flutterwith native bindings. - Implements
nutrient_flutter_platform_interfacefor the federated plugin architecture.