@@ -58,25 +58,22 @@ abstract class GlobalStore extends ChangeNotifier {
5858 required GlobalSettingsData globalSettings,
5959 required Iterable <Account > accounts,
6060 })
61- : _globalSettings = globalSettings,
61+ : settingsNotifier = GlobalSettingsStore (data : globalSettings) ,
6262 _accounts = Map .fromEntries (accounts.map ((a) => MapEntry (a.id, a)));
6363
64- // TODO use this as the actual store
65- final GlobalSettingsStore settingsNotifier = GlobalSettingsStore ();
64+ final GlobalSettingsStore settingsNotifier; // TODO rename as the store
6665
6766 /// A cache of the [GlobalSettingsData] singleton in the underlying data store.
6867 ///
6968 /// To be notified for changes to this value, subscribe to [settingsNotifier]
7069 /// (usually by calling [GlobalStoreWidget.settingsOf] ).
7170 /// The [GlobalStore] itself will not notify its own listeners.
72- GlobalSettingsData get globalSettings => _globalSettings;
73- GlobalSettingsData _globalSettings;
71+ GlobalSettingsData get globalSettings => settingsNotifier.data;
7472
7573 /// Update the global settings in the store.
7674 Future <void > updateGlobalSettings (GlobalSettingsCompanion data) async {
7775 await doUpdateGlobalSettings (data);
78- _globalSettings = _globalSettings.copyWithCompanion (data);
79- settingsNotifier.markUpdated ();
76+ settingsNotifier.update (data);
8077 }
8178
8279 /// Update the global settings in the underlying data store.
0 commit comments