Skip to content

Commit a8daf0a

Browse files
committed
explain usage of local state vs shared prefs
1 parent e37e9f3 commit a8daf0a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/presentation/prefs_dialog.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class PreferencesDialog extends StatefulWidget {
2222
}
2323

2424
class _PreferencesDialogState extends State<PreferencesDialog> {
25+
/// use local state instead of directly accessing shared preferences since we write the settings asynchronously without waiting
2526
late bool skipEmpty;
2627
late bool useCache;
2728
late bool followSymlinks;
@@ -54,7 +55,7 @@ class _PreferencesDialogState extends State<PreferencesDialog> {
5455
SwitchListTile(
5556
title: const Text('Use cache'),
5657
subtitle: const Text('fdupes 2.3.0+', softWrap: false),
57-
value: widget.sharedPreferences.getBool('usecache') ?? false,
58+
value: useCache,
5859
onChanged: (value) {
5960
setState(() {
6061
useCache = value;

0 commit comments

Comments
 (0)