EzConfig class

Constructors

EzConfig.init({required SharedPreferences preferences, required Map<String, dynamic> defaults, required EFUILang fallbackLang, required Set<String> assetPaths})
preferences => provide a SharedPreferences instance defaults => provide your brand colors, text styles, layout settings, etc. fallbackLang => provide a fallback EFUILang for Locales that EFUILang doesn't support (yet) assetPaths => provide the AssetImage paths for this app
factory

Properties

assetPaths Set<String>
AssetImage paths for the app
final
defaults Map<String, dynamic>
Default config
final
fallbackLang EFUILang
Fallback EFUILang for unsupported Locales english is recommended
final
hashCode int
The hash code for this object.
no setterinherited
preferences → SharedPreferences
SharedPreferences instance
final
prefs Map<String, dynamic>
Live values in use defaults merged with user preferences
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

l10nFallback EFUILang
no setter

Static Methods

get(String key) → dynamic
Get the keys EzConfig (nullable) value Uses the live values from prefs
getBool(String key) bool?
Get the keys EzConfig (nullable) bool value Uses the stored values from EzConfig.preferences
getDefault(String key) → dynamic
Get the keys default EzConfig (nullable) value
getDouble(String key) double?
Get the keys EzConfig (nullable) double value Uses the stored values from EzConfig.preferences
getInt(String key) int?
Get the keys EzConfig (nullable) int value Uses the stored values from EzConfig.preferences
getLocale() Locale?
Return the user's selected Locale, if any null otherwise
getString(String key) String?
Get the keys EzConfig (nullable) String value Uses the stored values from EzConfig.preferences
getStringList(String key) List<String>?
Get the keys EzConfig (nullable) List value Uses the stored values from EzConfig.preferences
getThemeMode() ThemeMode
Return the user's selected ThemeMode
isKeyAsset(String key) bool
Wether the key points to an AssetImage path via assetPaths
isPathAsset(String path) bool
Wether the path leads to an AssetImage via assetPaths
loadConfig(Map<String, dynamic> config) Future<void>
Load values to prefs/preferences
randomize(bool isDark, {bool shiny = true}) Future<void>
Create a pseudo-random config that follows the default vibe i.e. a triadic ColorScheme that should be highly legible Doubles are limited to half and/or twice their default values' There is an optional shiny chance (1 in 4096) to change the Locale
remove(String key, {bool reset = true, bool storageOnly = false}) Future<bool>
Remove the custom value for key When reset is true, the default value is restored (if present) By default, both the live EzConfig.prefs and stored EzConfig.preferences values are updated Set storageOnly to true to only update EzConfig.preferences Setting storageOnly to true will make reset moot
removeKeys(Set<String> keys, {bool reset = true, bool storageOnly = false}) Future<bool>
Remove the keys custom values When reset is true, the default value is restored (if present) By default, both the live EzConfig.prefs and stored EzConfig.preferences values are updated Set storageOnly to true to only update EzConfig.preferences Setting storageOnly to true will make reset moot Returns false if any keys fail to be removed, but all keys will be attempted
reset({Set<String>? skip, bool storageOnly = false}) Future<bool>
Resets all keys in EzConfig.prefs By default, both the live EzConfig.prefs and stored EzConfig.preferences values are updated Set storageOnly to true to only update EzConfig.preferences Returns false if any keys fail to be reset, but all keys will be attempted
setBool(String key, bool value, {bool storageOnly = false}) Future<bool>
Set the EzConfig key to value with type bool Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
setDouble(String key, double value, {bool storageOnly = false}) Future<bool>
Set the EzConfig key to value with type double Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
setInt(String key, int value, {bool storageOnly = false}) Future<bool>
Set the EzConfig key to value with type int Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
setString(String key, String value, {bool storageOnly = false}) Future<bool>
Set the EzConfig key to value with type String Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
setStringList(String key, List<String> value, {bool storageOnly = false}) Future<bool>
Set the EzConfig key to value with type List Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences