AppPreferenceEnsuredExtension<T, AP extends AppPreference<T> > extension
Extension methods for AppPreference All methods here works on derived type of AppPreference
Example:
class MySecret extends AppPreference<String> {
MySecret(SecureStorageAdapter adapter): super.direct(
adapter: adapter,
key: 'my_secret',
defaultValue: 'i do not know',
);
}
Future<MySecret> createMySecret(SecureStorageAdapter adapter) => MySecrete(adapter).ensuredCreation();
createMySecret
returns Future<MySecrete>
instead of Future<AppPreference<String>>
- on
-
- AP
Methods
-
ensuredCreation(
) → Future< AP> - Wait until the preference is ready to use. Could be used as an async factory for AppPreference.
-
ensuredRead(
) → Future< T> - Read the value of the preference when it is ready.
-
ensuredWrite(
T value) → Future< AP> - Ensure the value is really written to the storage.