add reuseAddress pref

This commit is contained in:
sneurlax 2024-07-02 23:08:37 -05:00 committed by julian-CStack
parent 218809327a
commit 9ac00e2ed0

View file

@ -1131,4 +1131,30 @@ class Prefs extends ChangeNotifier {
) as bool? ??
false;
}
// Reuse addresses (ie., don't generate new addresses by default).
bool _reuseAddress = false;
bool get reuseAddress => _reuseAddress;
set reuseAddress(bool reuseAddress) {
if (_reuseAddress != reuseAddress) {
DB.instance.put<dynamic>(
boxName: DB.boxNamePrefs,
key: "reuseAddress",
value: reuseAddress,
);
_reuseAddress = reuseAddress;
notifyListeners();
}
}
Future<bool> _getReuseAddress() async {
return await DB.instance.get<dynamic>(
boxName: DB.boxNamePrefs,
key: "reuseAddress",
) as bool? ??
true;
}
}