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:

OptionDescription
defaultBehaviorShows an alert for the user to choose how to resolve the conflict.
closeAutomatically closes the document when a conflict is detected.
saveSaves in-memory changes, overriding external modifications. Restores the file if deleted.
reloadDiscards 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:

PlatformSupport
iOSYes
AndroidNo
WebNo

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.