prefs<TPrefs extends PrefsBase> method
TPrefs
prefs<TPrefs extends PrefsBase>(
- TPrefs query()
Get state-preserved SharedPreferences
by passing the PrefsBase code generated by the builder.
All changes to SharedPreferences
are monitored and the widgets used are updated when changes are made.
ビルダーによりコード生成されたPrefsBaseを渡すことにより状態を保持されたSharedPreferences
を取得します。
SharedPreferences
の変更はすべて監視され、変更が行われた際、利用したウィジェットは更新されます。
final prefs = ref.prefs(() => appPrefs); // Get the shared preferences.
Implementation
TPrefs prefs<TPrefs extends PrefsBase>(
TPrefs Function() query,
) {
return app.watch((ref) => query.call(), disposal: false);
}