dart:io opens files without FILE_SHARE_DELETE, so MoveFileExW with MOVEFILE_REPLACE_EXISTING - and any other replacement strategy - fails while such a reader holds the document open. Fall back to the upstream in-place rewrite so a hostile reader costs at most crash-atomicity for that one write instead of silently dropping it, and sweep the staging copy the rename did not consume.
shared_preferences_windows
The Windows implementation of shared_preferences.
Usage
This package is endorsed, which means you can simply use shared_preferences
normally. This package will be automatically included in your app when you do,
so you do not need to add it to your pubspec.yaml.
However, if you import this package to use any of its APIs directly, you
should add it to your pubspec.yaml as usual.