AnasLocalizationStorage class abstract

A utility class for managing the selected locale in local storage.

Provides static methods to save, load, and clear the user's selected locale code using KeyValueStorage. This can be extended to support cloud storage in the future.

This is a public class due to allowing developers to freely access and modify their locale preferences.

You can inject a custom storage implementation for testing or alternative backends:

// Use custom storage
AnasLocalizationStorage.storageFactory = () async => MyCustomStorage();

Constructors

AnasLocalizationStorage()

Properties

hashCode int
The hash code for this object.
no setterinherited
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

storageFactory Future<KeyValueStorage> Function()
Factory function to create storage instances. Override this for testing or custom storage backends.
getter/setter pair

Static Methods

clearLocale() Future<void>
Removes the saved locale from local storage.
loadLocale() Future<String?>
Loads the selected locale code from local storage.
saveLocale(String localeCode) Future<void>
Saves the selected locale code to local storage.