get<T> static method
Get the data.
Specify the key of the value you want to get for key
.
If the value does not exist in the specified key
,
the value of defaultValue
will be returned.
Implementation
static T get<T>(String key, T defaultValue) {
if (!isInitialized) {
throw Exception(
"It has not been initialized. Please initialize it by executing [initialize()].",
);
}
if (!containsKey(key)) {
return defaultValue;
}
return _preferences?.get(key) as T ?? defaultValue;
}