Conflict resolution
Nutrient Flutter SDK offers a built-in mechanism for detecting external file changes on iOS. When outside modifications conflict with unsaved local changes, the SDK can automatically resolve conflicts or present options to the user.
Conflict resolution options
Configure conflict resolution behavior using IOSFileConflictResolution in PdfConfiguration:
NutrientView( documentPath: documentPath, configuration: PdfConfiguration( iOSFileConflictResolution: IOSFileConflictResolution.defaultBehavior, ),);Available options
The following conflict resolution options are available:
| Option | Description |
|---|---|
defaultBehavior | Shows an alert for the user to choose how to resolve the conflict. |
close | Automatically closes the document when a conflict is detected. |
save | Saves in-memory changes, overriding external modifications. Restores the file if deleted. |
reload | Discards local changes and reloads the document from disk. |
Example
import 'package:nutrient_flutter/nutrient_flutter.dart';
class DocumentViewer extends StatelessWidget { final String documentPath;
const DocumentViewer({super.key, required this.documentPath});
@override Widget build(BuildContext context) { return Scaffold( body: NutrientView( documentPath: documentPath, configuration: PdfConfiguration( // Automatically save local changes when conflicts occur. iOSFileConflictResolution: IOSFileConflictResolution.save, ), ), ); }}Platform support
Conflict resolution is supported on the following platforms:
| Platform | Support |
|---|---|
| iOS | Yes |
| Android | No |
| Web | No |
Conflict resolution relies on iOS file coordination APIs and APFS copy-on-write functionality. On Android and web, external file changes are not automatically detected.