EzConfig class

Singleton class for managing user customization

Constructors

EzConfig.init({required SharedPreferences preferences, required Set<String> assetPaths, required Map<String, dynamic> defaults})
preferences => provide a SharedPreferences instance assetPaths => provide your AssetImage paths for this app defaults => provide your brand colors, text styles, layout settings, etc.
factory

Properties

assetPaths Set<String>
Asset paths for the app Used for AssetImage and video checks
final
defaults Map<String, dynamic>
Default config
final
hashCode int
The hash code for this object.
no setterinherited
keys Map<String, Type>
All keys (and their value Type) in the known EzConfigverse
final
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 Methods

get(String key) → dynamic
Get the keys EzConfig value? Uses the live values from prefs
getBool(String key) bool?
Get the keys EzConfig value Uses the value stored in EzConfig.preferences
getDefault(String key) → dynamic
Get the keys default EzConfig value?
getDouble(String key) double?
Get the keys EzConfig value Uses the value stored in EzConfig.preferences
getInt(String key) int?
Get the keys EzConfig value Uses the value stored in EzConfig.preferences
getLocale() Locale?
Return the user's selected Locale?
getString(String key) String?
Get the keys EzConfig value Uses the value stored in EzConfig.preferences
getStringList(String key) List<String>?
Get the keys EzConfig value Uses the value stored in EzConfig.preferences
getThemeMode() ThemeMode
Return the user's selected ThemeMode
isKeyAsset(String key) bool
Wether the key contains the value to a recognized asset path From the EzConfig.init field assetPaths
isPathAsset(String path) bool
Wether the path leads to a recognized asset From the EzConfig.init field assetPaths
loadConfig(Map<String, dynamic> config) Future<void>
Load values to prefs/preferences
randomize(bool isDark) Future<void>
Create a pseudo-random config that follows the default vibe
remove(String key, {bool storageOnly = false}) Future<bool>
Remove the custom value for key Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
removeKeys(Set<String> keys, {bool storageOnly = false}) Future<bool>
Remove the keys custom values Defaults to both the live EzConfig.prefs and stored EzConfig.preferences Optionally set storageOnly to true to only update EzConfig.preferences
reset({bool storageOnly = false}) Future<bool>
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