FlutterSecureStorage class
A class to manage secure storage in a Flutter application across multiple platforms.
Constructors
- FlutterSecureStorage.new({IOSOptions iOptions = IOSOptions.defaultOptions, AndroidOptions aOptions = AndroidOptions.defaultOptions, LinuxOptions lOptions = LinuxOptions.defaultOptions, WindowsOptions wOptions = WindowsOptions.defaultOptions, WebOptions webOptions = WebOptions.defaultOptions, AppleOptions mOptions = MacOsOptions.defaultOptions})
-
Creates a FlutterSecureStorage instance with optional platform-specific
configurations.
const
Properties
- aOptions → AndroidOptions
-
Platform-specific options for Android.
final
-
getListeners
→ Map<
String, List< ValueChanged< >String?> > -
Returns all listeners for testing purposes
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- iOptions → IOSOptions
-
Platform-specific options for iOS.
final
- lOptions → LinuxOptions
-
Platform-specific options for Linux.
final
- mOptions → AppleOptions
-
Platform-specific options for macOS.
final
-
onCupertinoProtectedDataAvailabilityChanged
→ Stream<
bool> ? -
iOS only feature
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- webOptions → WebOptions
-
Platform-specific options for Web.
final
- wOptions → WindowsOptions
-
Platform-specific options for Windows.
final
Methods
-
containsKey(
{required String key, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< bool> -
Returns true if the storage contains the given
key
. -
delete(
{required String key, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< void> -
Deletes associated value for the given
key
. -
deleteAll(
{AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< void> - Deletes all keys with associated values.
-
isCupertinoProtectedDataAvailable(
) → Future< bool?> - iOS and macOS only feature.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
{required String key, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< String?> -
Decrypts and returns the value for the given
key
or null ifkey
is not in the storage. -
readAll(
{AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< Map< String, String> > - Decrypts and returns all keys with associated values.
-
registerListener(
{required String key, required ValueChanged< String?> listener}) → void -
Register
listener
forkey
with the value injected for the listener. Thelistener
will still be called when you delete thekey
with the injected value as null. This listener will be added to the list of registered listeners for thatkey
. -
toString(
) → String -
A string representation of this object.
inherited
-
unregisterAllListeners(
) → void - Unregister all listeners for all keys.
-
unregisterAllListenersForKey(
{required String key}) → void -
Unregister all listeners for
key
. -
unregisterListener(
{required String key, required ValueChanged< String?> listener}) → void -
Unregister listener for Key.
The other registered listeners for
key
will be remained. -
write(
{required String key, required String? value, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) → Future< void> -
Encrypts and saves the
key
with the givenvalue
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
setMockInitialValues(
Map< String, String> values) → void - Initializes the shared preferences with mock values for testing.