Auto save PDF files in Flutter
Nutrient Flutter SDK saves a modified open document to your device’s local storage. You can also save changes manually. The SDK saves files locally on the device, so you don’t need a server.
Use auto save
Nutrient Flutter SDK saves changed, created, or deleted annotations and bookmarks in these cases:
- The application goes into the background.
- The device configuration changes, such as when the device orientation, locale, or keyboard changes.
- Another view fully covers the PDF view.
- The user digitally signs a document.
Disable automatic saving
Autosave is enabled by default. To disable autosave, set disableAutosave: true on the NutrientViewConfiguration object. Refer to the Nutrient view configuration(opens in a new tab) API reference for details.
NutrientDocumentView( documentPath: documentPath, configuration: const NutrientViewConfiguration(disableAutosave: true),)Save manually
Call save() on the document exposed by the controller to save changes manually:
final saved = await controller.document.save();save() returns true when the platform accepts the save request. To get notified when the save completes, listen to the documentSaved event. Refer to the document saved event(opens in a new tab) API reference for details.
controller.events.documentSaved.listen((event) { print('Document saved to ${event.path ?? 'the original file'}');});To save documents manually with Nutrient Flutter SDK, pass a writable documentPath to NutrientDocumentView.