### Run Integration Tests Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Navigate to the example directory and execute this command to run integration tests. ```bash flutter drive --target=test_driver/app.dart ``` -------------------------------- ### Install Libsecret for Fedora/RHEL/CentOS Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Install the Libsecret development and runtime packages on Fedora, RHEL, or CentOS Linux distributions. This ensures the necessary libraries are available for Flutter Secure Storage. ```bash sudo dnf install libsecret libsecret-devel ``` -------------------------------- ### Install Libsecret for Ubuntu/Debian Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Install the Libsecret development and runtime packages on Ubuntu or Debian-based Linux distributions. This is required for Flutter Secure Storage to function correctly on these systems. ```bash sudo apt install libsecret-1-0 libsecret-1-dev ``` -------------------------------- ### Migrate with Specific Algorithms and Backup Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Configure migration with specific encryption algorithms (RSA and AES) and enable backup protection. This is useful when transitioning to a new, more secure encryption setup. ```dart // Migrating from old to new algorithm with backup protection final storage = FlutterSecureStorage( aOptions: AndroidOptions( migrateWithBackup: true, keyCipherAlgorithm: KeyCipherAlgorithm.RSA_ECB_OAEPwithSHA_256andMGF1Padding, storageCipherAlgorithm: StorageCipherAlgorithm.AES_GCM_NoPadding, ), ); ``` -------------------------------- ### Install Libsecret for Arch Linux Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Install the Libsecret package on Arch-based Linux distributions. This single package includes both development and runtime modules required for Flutter Secure Storage. ```bash sudo pacman -S libsecret ``` -------------------------------- ### Flatpak Runtime Configuration for Libsecret Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Configure the Flatpak runtime to include Libsecret for sandboxed applications. Ensure the runtime version is at least 25.08 or newer. This example shows how to specify the runtime in your app manifest. ```yaml runtime: org.freedesktop.Platform runtime-version: '25.08' # Should be at least 25.08 (or newer) ``` -------------------------------- ### Get AndroidOptions as Map Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AndroidOptions/params.html Retrieves the Android-specific options for secure storage as a map of string key-value pairs. This is achieved by calling the toMap() method. ```dart Map get params => toMap(); ``` -------------------------------- ### IOSOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions/IOSOptions.html Creates an instance of `IosOptions` with configurable parameters for keychain access and storage behavior. ```APIDOC ## IOSOptions Constructor ### Description Creates an instance of `IosOptions` with configurable parameters for keychain access and storage behavior. ### Parameters #### Named Parameters - **accountName** (String?) - Optional - The account name for keychain access. Defaults to `AppleOptions.defaultAccountName`. - **groupId** (String?) - Optional - The group identifier for keychain sharing. - **accessibility** (KeychainAccessibility?) - Optional - The keychain accessibility level. Defaults to `KeychainAccessibility.unlocked`. - **synchronizable** (bool) - Optional - Whether the item should be synchronized across devices. Defaults to `false`. - **label** (String?) - Optional - A label for the keychain item. - **description** (String?) - Optional - A description for the keychain item. - **comment** (String?) - Optional - A comment for the keychain item. - **isInvisible** (bool?) - Optional - Whether the item is invisible. - **isNegative** (bool?) - Optional - Whether the item is negative. - **creationDate** (DateTime?) - Optional - The creation date of the keychain item. - **lastModifiedDate** (DateTime?) - Optional - The last modified date of the keychain item. - **resultLimit** (int?) - Optional - The limit for search results. - **shouldReturnPersistentReference** (bool?) - Optional - Whether to return a persistent reference. - **authenticationUIBehavior** (String?) - Optional - The behavior of the authentication UI. - **accessControlFlags** (List) - Optional - A list of access control flags. Defaults to an empty list. - **useSecureEnclave** (bool) - Optional - Whether to use the secure enclave. Defaults to `false`. ``` -------------------------------- ### IOSOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions-class.html Creates an instance of `IOSOptions` with configurable parameters for keychain access and storage behavior. ```APIDOC ## IOSOptions() ### Description Creates an instance of `IosOptions` with configurable parameters for keychain access and storage behavior. ### Parameters #### Named Parameters * **accountName** (String?) - Optional - `kSecAttrService`: **Shared**. Represents the service or application name associated with the item. Typically used to group related keychain items. * **groupId** (String?) - Optional - `kSecAttrAccessGroup`: **Shared**. Specifies the app group for shared access. Allows multiple apps in the same app group to access the item. * **accessibility** (KeychainAccessibility?) - Optional - `kSecAttrAccessible`: **Shared**. Defines the accessibility level of the keychain item. Controls when the item is accessible (e.g., when the device is unlocked or after first unlock). * **synchronizable** (bool) - Optional - `kSecAttrSynchronizable`: **Shared**. Indicates whether the keychain item should be synchronized with iCloud. `true` enables synchronization, `false` disables it. Defaults to `false`. * **label** (String?) - Optional - `kSecAttrLabel`: **Unique**. A user-visible label for the keychain item. Helps identify the item in keychain management tools. * **description** (String?) - Optional - `kSecAttrDescription`: **Shared or Unique**. A description of the keychain item. Can describe a category of items (shared) or be specific to a single item. * **comment** (String?) - Optional - `kSecAttrComment`: **Shared or Unique**. A comment associated with the keychain item. Often used for metadata or debugging information. * **isInvisible** (bool?) - Optional - `kSecAttrIsInvisible`: **Shared or Unique**. Indicates whether the keychain item is hidden from user-visible lists. Can apply to all items in a category (shared) or specific items (unique). * **isNegative** (bool?) - Optional - `kSecAttrIsNegative`: **Unique**. Indicates whether the item is a placeholder or a negative entry. Typically unique to individual keychain items. * **creationDate** (DateTime?) - Optional - `kSecAttrCreationDate`: **Unique**. The creation date of the keychain item. Automatically set by the system when an item is created. * **lastModifiedDate** (DateTime?) - Optional - `kSecAttrModificationDate`: **Unique**. The last modification date of the keychain item. Automatically updated when an item is modified. * **resultLimit** (int?) - Optional - `kSecMatchLimit`: **Action-Specific**. Specifies the maximum number of results to return in a query. For example, `1` for a single result, or `all` for all matching results. * **shouldReturnPersistentReference** (bool?) - Optional - `kSecReturnPersistentRef`: **Action-Specific**. Indicates whether to return a persistent reference to the keychain item. Used for persistent access across app sessions. * **authenticationUIBehavior** (String?) - Optional - `kSecUseAuthenticationUI`: **Shared**. Controls how authentication UI is presented during secure operations. Determines whether authentication prompts are displayed to the user. * **accessControlFlags** (List) - Optional - Keychain access control flags define security conditions for accessing items. These flags can be combined to create custom security policies. Defaults to an empty list. * **useSecureEnclave** (bool) - Optional - When true, opts into Secure Enclave–backed protection on iOS/macOS. Defaults to `false`. ``` -------------------------------- ### LinuxOptions constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions/LinuxOptions.html Creates an instance of `LinuxOptions` with no additional configuration. ```APIDOC ## LinuxOptions.new ### Description Creates an instance of `LinuxOptions` with no additional configuration. ### Constructor `const LinuxOptions()` ### Implementation ```dart const LinuxOptions(); ``` ``` -------------------------------- ### Create LinuxOptions with Default Settings Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions/LinuxOptions.html Use the default constructor for LinuxOptions when no specific configuration is needed for Linux. ```dart const LinuxOptions(); ``` -------------------------------- ### WebOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions/WebOptions.html Creates an instance of `WebOptions` with configurable parameters for secure storage behavior on web platforms. ```APIDOC ## WebOptions constructor ### Description Creates an instance of `WebOptions` with configurable parameters for secure storage behavior on web platforms. ### Parameters #### Constructor Parameters - **dbName** (String) - Optional - The name of the database used for secure storage. Defaults to `'FlutterEncryptedStorage'`. - **publicKey** (String) - Optional - The public key used for encryption. Defaults to `'FlutterSecureStorage'`. - **wrapKey** (String) - Optional - The key used to wrap the encryption key. - **wrapKeyIv** (String) - Optional - The initialization vector (IV) used for the wrap key. - **useSessionStorage** (bool) - Optional - Whether to use session storage instead of local storage. Defaults to `false`. ``` -------------------------------- ### Get onCupertinoProtectedDataAvailabilityChanged Stream Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage/onCupertinoProtectedDataAvailabilityChanged.html This snippet shows how to access the onCupertinoProtectedDataAvailabilityChanged stream. It checks if the platform is MethodChannelFlutterSecureStorage before accessing the stream, returning null otherwise. This feature is exclusive to iOS. ```dart Stream? get onCupertinoProtectedDataAvailabilityChanged => _platform is MethodChannelFlutterSecureStorage ? (_platform as MethodChannelFlutterSecureStorage) .onCupertinoProtectedDataAvailabilityChanged : null; ``` -------------------------------- ### AppleOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AppleOptions/AppleOptions.html Creates an instance of `AppleOptions` with configurable parameters for keychain access and storage behavior on Apple platforms. ```APIDOC ## AppleOptions Constructor ### Description Creates an instance of `AppleOptions` with configurable parameters for keychain access and storage behavior. ### Parameters - **accountName** (String?) - Optional - The account name for keychain access. Defaults to `AppleOptions.defaultAccountName`. - **groupId** (String?) - Optional - The group identifier for keychain sharing. - **accessibility** (KeychainAccessibility?) - Optional - The keychain accessibility level. Defaults to `KeychainAccessibility.unlocked`. - **synchronizable** (bool) - Optional - Whether the item should be synchronized across devices. Defaults to `false`. - **label** (String?) - Optional - A label for the keychain item. - **description** (String?) - Optional - A description for the keychain item. - **comment** (String?) - Optional - A comment for the keychain item. - **isInvisible** (bool?) - Optional - Whether the keychain item is invisible. - **isNegative** (bool?) - Optional - Whether the keychain item is negative. - **creationDate** (DateTime?) - Optional - The creation date of the keychain item. - **lastModifiedDate** (DateTime?) - Optional - The last modified date of the keychain item. - **resultLimit** (int?) - Optional - The limit for the number of results. - **shouldReturnPersistentReference** (bool?) - Optional - Whether to return a persistent reference. - **authenticationUIBehavior** (String?) - Optional - The behavior of the authentication UI. - **accessControlFlags** (List) - Optional - A list of access control flags. Defaults to an empty list. - **useSecureEnclave** (bool) - Optional - Whether to use the secure enclave. Defaults to `false`. ``` -------------------------------- ### IOSOptions.defaultOptions Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions-class.html A predefined `IosOptions` instance with default settings. ```APIDOC ## IOSOptions.defaultOptions ### Description A predefined `IosOptions` instance with default settings. ### Type `const IOSOptions` ``` -------------------------------- ### Migrate Old Data with WindowsOptions Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions/WindowsOptions.html Demonstrates how to read all old data using WindowsOptions with backward compatibility enabled. This can be used to migrate data from previous versions. ```dart await FlutterSecureStorage().readAll( const WindowsOptions(useBackwardCompatibility: true), ); ``` -------------------------------- ### WebOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions-class.html Creates an instance of `WebOptions` with configurable parameters for secure storage behavior on web platforms. You can customize the database name, public key, wrap key, wrap key IV, and whether to use session storage. ```APIDOC ## WebOptions Constructor ### Description Creates an instance of `WebOptions` with configurable parameters for secure storage behavior on web platforms. ### Parameters * **dbName** (String) - Optional - The name of the database used for secure storage. Defaults to `'FlutterEncryptedStorage'`. * **publicKey** (String) - Optional - The public key used for encryption. Defaults to `'FlutterSecureStorage'`. * **wrapKey** (String) - Optional - The key used to wrap the encryption key. * **wrapKeyIv** (String) - Optional - The initialization vector (IV) used for the wrap key. * **useSessionStorage** (bool) - Optional - Whether to use session storage instead of local storage. Defaults to `false`. ``` -------------------------------- ### defaultOptions Constant Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions-class.html A predefined `WebOptions` instance with default settings, providing a convenient way to initialize secure storage with standard configurations. ```APIDOC ## defaultOptions Constant ### Description A predefined `WebOptions` instance with default settings. ### Value * **WebOptions** - An instance of `WebOptions` with default values for all parameters. ``` -------------------------------- ### Fetch Flutter Dependencies Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Run this command in the project's root directory to fetch Flutter dependencies. ```bash flutter pub get ``` -------------------------------- ### WindowsOptions Methods Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions-class.html Lists the methods available for the WindowsOptions class, including copying instances, handling non-existent methods, and converting to a map or string. ```APIDOC ## Methods ### copyWith ```dart WindowsOptions copyWith({bool? useBackwardCompatibility}) ``` #### Description Creates a new instance of `WindowsOptions` by copying the current instance and replacing specified properties with new values. #### Parameters * **useBackwardCompatibility** (bool?) - Optional - The new value for `useBackwardCompatibility` to be used in the copied instance. ### noSuchMethod ```dart dynamic noSuchMethod(Invocation invocation) ``` #### Description Invoked when a nonexistent method or property is accessed. (Inherited from Object) ### toMap ```dart Map toMap() ``` #### Description Converts the options into a map representation. #### Returns A `Map` representing the options. ``` -------------------------------- ### WebOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions/WebOptions.html Use this constructor to create an instance of WebOptions with custom parameters for web secure storage. It allows configuration of the database name, public key, wrap key, and whether to use session storage. ```dart const WebOptions({ this.dbName = 'FlutterEncryptedStorage', this.publicKey = 'FlutterSecureStorage', this.wrapKey = '', this.wrapKeyIv = '', this.useSessionStorage = false, }); ``` -------------------------------- ### Bootstrap Workspace with Melos Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Bootstrap the development workspace using melos to link and configure dependencies. ```bash melos bootstrap ``` -------------------------------- ### WindowsOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions-class.html Initializes WindowsOptions with optional backward compatibility settings. Backward compatibility can affect performance and key handling. ```APIDOC ## Constructors ### WindowsOptions ```dart WindowsOptions({bool useBackwardCompatibility = false}) ``` #### Description Initializes `WindowsOptions`. If `useBackwardCompatibility` is set to `true`, the storage will attempt to read from and migrate values written by previous versions. This may introduce a performance hit and potential errors for certain keys. The default value is `false`. **Important:** Set `useBackwardCompatibility` to `false` if your keys contain characters like `"`, `<`, `>`, `|`, `:`, `*`, `?`, `/`, `\`, or any ASCII control characters, or if keys contain `/../`, `\..`, or their combinations, or if keys are excessively long. #### Parameters * **useBackwardCompatibility** (bool) - Optional - If `true`, enables backward compatibility for reading and migrating values from previous storage versions. Defaults to `false`. ``` -------------------------------- ### LinuxOptions Methods Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions-class.html Lists the methods available for the LinuxOptions class, including overridden and inherited ones. ```APIDOC ## Methods ### noSuchMethod(Invocation invocation) → dynamic - **Description**: Invoked when a nonexistent method or property is accessed. - **Inherited**: true ### toMap() → Map - **Description**: Converts the `LinuxOptions` instance into a map representation. - **Override**: true ### toString() → String - **Description**: A string representation of this object. - **Inherited**: true ``` -------------------------------- ### IOSOptions Constructor Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions/IOSOptions.html Shows the implementation of the IOSOptions constructor, which forwards its parameters to the superclass constructor. ```dart const IOSOptions({ super.accountName, super.groupId, super.accessibility, super.synchronizable, super.label, super.description, super.comment, super.isInvisible, super.isNegative, super.creationDate, super.lastModifiedDate, super.resultLimit, super.shouldReturnPersistentReference, super.authenticationUIBehavior, super.accessControlFlags, super.useSecureEnclave, }); ``` -------------------------------- ### WindowsOptions Default Options Constant Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions/defaultOptions-constant.html A predefined `WindowsOptions` instance with default settings. Use this when no specific options are required. ```dart static const WindowsOptions defaultOptions = WindowsOptions(); ``` -------------------------------- ### Add Pub Executables to Path Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Optionally, add the pub executables directory to your system's PATH environment variable. ```bash export PATH="$PATH":"$HOME/.pub-cache/bin" ``` -------------------------------- ### LinuxOptions Constructors Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions-class.html Provides information about the constructors available for the LinuxOptions class. ```APIDOC ## Constructors ### LinuxOptions() - **Description**: Creates an instance of `LinuxOptions` with no additional configuration. - **Const**: true ``` -------------------------------- ### TestFlutterSecureStoragePlatform Constructors Source: https://pub.dev/documentation/flutter_secure_storage/latest/test_test_flutter_secure_storage_platform/TestFlutterSecureStoragePlatform-class.html Provides information on how to create an instance of TestFlutterSecureStoragePlatform. ```APIDOC ## TestFlutterSecureStoragePlatform(Map data) ### Description Creates an instance of `TestFlutterSecureStoragePlatform` with an in-memory data store. ### Parameters #### Path Parameters - **data** (Map) - Required - The initial in-memory data store. ``` -------------------------------- ### AppleOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AppleOptions/AppleOptions.html Creates an instance of AppleOptions with configurable parameters for keychain access and storage behavior. Use this to customize how data is stored securely on Apple devices. ```dart const AppleOptions({ this.accountName = AppleOptions.defaultAccountName, this.groupId, this.accessibility = KeychainAccessibility.unlocked, this.synchronizable = false, this.label, this.description, this.comment, this.isInvisible, this.isNegative, this.creationDate, this.lastModifiedDate, this.resultLimit, this.shouldReturnPersistentReference, this.authenticationUIBehavior, this.accessControlFlags = const [], this.useSecureEnclave = false, }); ``` -------------------------------- ### LinuxOptions Default Options Constant Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions/defaultOptions-constant.html A predefined LinuxOptions instance with default settings. Use this when no specific options are required. ```dart static const LinuxOptions defaultOptions = LinuxOptions(); ``` -------------------------------- ### copyWith Method Signature Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions/copyWith.html Creates a new instance of `WindowsOptions` by copying the current instance and replacing specified properties with new values. ```APIDOC ## copyWith Method ### Description Creates a new instance of `WindowsOptions` by copying the current instance and replacing specified properties with new values. ### Method Signature ```dart WindowsOptions copyWith({ bool? useBackwardCompatibility, }) ``` ### Parameters #### Optional Parameters - **useBackwardCompatibility** (bool?) - Description: If provided, the new instance will have this value for `useBackwardCompatibility`. Otherwise, the value from the current instance is used. ### Implementation ```dart WindowsOptions copyWith({ bool? useBackwardCompatibility, }) => WindowsOptions( useBackwardCompatibility: useBackwardCompatibility ?? _useBackwardCompatibility, ); ``` ``` -------------------------------- ### MacOsOptions.defaultOptions Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/MacOsOptions-class.html Provides a predefined `MacosOptions` instance with default settings for macOS secure storage. ```APIDOC ## MacOsOptions.defaultOptions ### Description A predefined `MacosOptions` instance with default settings. This constant can be used to initialize secure storage operations on macOS with standard configurations. ### Type `const MacOsOptions` ``` -------------------------------- ### MacOsOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/MacOsOptions/MacOsOptions.html Creates an instance of `MacosOptions` with configurable parameters for keychain access and storage behavior on macOS. ```APIDOC ## MacOsOptions() ### Description Constructs a new `MacOsOptions` object, allowing customization of various settings for secure storage on macOS. ### Parameters - **accountName** (String?) - Optional - The name of the account associated with the keychain item. Defaults to `AppleOptions.defaultAccountName`. - **groupId** (String?) - Optional - The identifier for the group the keychain item belongs to. - **accessibility** (KeychainAccessibility?) - Optional - The accessibility level for the keychain item. Defaults to `KeychainAccessibility.unlocked`. - **synchronizable** (bool) - Optional - Whether the keychain item should be synchronized across devices. Defaults to `false`. - **label** (String?) - Optional - A label for the keychain item. - **description** (String?) - Optional - A description for the keychain item. - **comment** (String?) - Optional - A comment for the keychain item. - **isInvisible** (bool?) - Optional - Whether the keychain item is invisible. - **isNegative** (bool?) - Optional - Whether the keychain item is negative. - **creationDate** (DateTime?) - Optional - The creation date of the keychain item. - **lastModifiedDate** (DateTime?) - Optional - The last modified date of the keychain item. - **resultLimit** (int?) - Optional - The limit for results when querying the keychain. - **shouldReturnPersistentReference** (bool?) - Optional - Whether to return a persistent reference for the keychain item. - **authenticationUIBehavior** (String?) - Optional - Specifies the behavior of the authentication UI. - **accessControlFlags** (List) - Optional - A list of access control flags for the keychain item. Defaults to an empty list. - **usesDataProtectionKeychain** (bool) - Optional - Whether to use data protection keychain. Defaults to `true`. - **useSecureEnclave** (bool) - Optional - Whether to use the secure enclave for storage. Defaults to `false`. ``` -------------------------------- ### MacOsOptions Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/MacOsOptions/MacOsOptions.html Shows the implementation of the MacOsOptions constructor, which initializes superclass properties and specific MacOsOptions fields like usesDataProtectionKeychain. ```dart const MacOsOptions({ super.accountName, super.groupId, super.accessibility, super.synchronizable, super.label, super.description, super.comment, super.isInvisible, super.isNegative, super.creationDate, super.lastModifiedDate, super.resultLimit, super.shouldReturnPersistentReference, super.authenticationUIBehavior, super.accessControlFlags, this.usesDataProtectionKeychain = true, super.useSecureEnclave = false, }); ``` -------------------------------- ### WebOptions Default Options Constant Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions/defaultOptions-constant.html A predefined `WebOptions` instance with default settings. This can be used as a fallback or when no specific options are required. ```dart static const WebOptions defaultOptions = WebOptions(); ``` -------------------------------- ### AppleOptions Methods Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AppleOptions-class.html Methods available on the AppleOptions class. ```APIDOC ## Methods * **toMap() → Map** Converts the options into a map representation. * **noSuchMethod(Invocation invocation) → dynamic** Invoked when a nonexistent method or property is accessed. ``` -------------------------------- ### ReadAll Method Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/test_test_flutter_secure_storage_platform/TestFlutterSecureStoragePlatform/readAll.html This snippet shows the implementation of the readAll method, which returns all data from storage. It is marked with @override and accepts a map of options. ```dart @override Future> readAll({ required Map options, }) override Reads all key-value pairs from secure storage. Parameters: * `options`: A map of platform-specific options for the read-all operation. Returns: * A Future that resolves to a map containing all key-value pairs in storage. ## Implementation ``` @override Future> readAll({ required Map options, }) async => data; ``` ``` -------------------------------- ### readAll Method Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage/readAll.html Decrypts and returns all keys with associated values from secure storage. Supports optional configuration for iOS, Android, Linux, Web, macOS, and Windows. ```APIDOC ## readAll ### Description Decrypts and returns all keys with associated values. This method can throw a `PlatformException`. ### Method Signature `Future> readAll({AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions})` ### Parameters #### Optional Platform Options - **iOptions** (AppleOptions?) - Optional iOS specific options. - **aOptions** (AndroidOptions?) - Optional Android specific options. - **lOptions** (LinuxOptions?) - Optional Linux specific options. - **webOptions** (WebOptions?) - Optional Web specific options. - **mOptions** (AppleOptions?) - Optional macOS specific options. - **wOptions** (WindowsOptions?) - Optional Windows specific options. ### Returns - `Future>` - A future that completes with a map containing all stored key-value pairs. ``` -------------------------------- ### LinuxOptions Constants Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions-class.html Information about the predefined constants for the LinuxOptions class. ```APIDOC ## Constants ### defaultOptions → const LinuxOptions - **Description**: A predefined `LinuxOptions` instance with default settings. ``` -------------------------------- ### IOSOptions Default Options Constant Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions/defaultOptions-constant.html A predefined IOSOptions instance with default settings. This can be used as a fallback or when no specific options are required. ```dart static const IOSOptions defaultOptions = IOSOptions(); ``` -------------------------------- ### TestFlutterSecureStoragePlatform Methods Source: https://pub.dev/documentation/flutter_secure_storage/latest/test_test_flutter_secure_storage_platform/TestFlutterSecureStoragePlatform-class.html Details on the methods available for interacting with the in-memory secure storage. ```APIDOC ## containsKey({required String key, required Map options}) ### Description Checks whether a key exists in secure storage. ### Method Future ### Parameters #### Path Parameters - **key** (String) - Required - The key to check for. - **options** (Map) - Required - Additional options for the operation. ``` ```APIDOC ## delete({required String key, required Map options}) ### Description Deletes a key-value pair from secure storage. ### Method Future ### Parameters #### Path Parameters - **key** (String) - Required - The key of the entry to delete. - **options** (Map) - Required - Additional options for the operation. ``` ```APIDOC ## deleteAll({required Map options}) ### Description Deletes all key-value pairs from secure storage. ### Method Future ### Parameters #### Path Parameters - **options** (Map) - Required - Additional options for the operation. ``` ```APIDOC ## read({required String key, required Map options}) ### Description Reads a value from secure storage by its key. ### Method Future ### Parameters #### Path Parameters - **key** (String) - Required - The key of the value to read. - **options** (Map) - Required - Additional options for the operation. ``` ```APIDOC ## readAll({required Map options}) ### Description Reads all key-value pairs from secure storage. ### Method Future> ### Parameters #### Path Parameters - **options** (Map) - Required - Additional options for the operation. ``` ```APIDOC ## write({required String key, required String value, required Map options}) ### Description Writes a key-value pair to secure storage. ### Method Future ### Parameters #### Path Parameters - **key** (String) - Required - The key for the value. - **value** (String) - Required - The value to store. - **options** (Map) - Required - Additional options for the operation. ``` -------------------------------- ### WindowsOptions Constants Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions-class.html Highlights the predefined constant `defaultOptions` for the WindowsOptions class. ```APIDOC ## Constants ### defaultOptions ```dart static const WindowsOptions defaultOptions ``` #### Description A predefined `WindowsOptions` instance with default settings. ``` -------------------------------- ### TestFlutterSecureStoragePlatform Constructor Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/test_test_flutter_secure_storage_platform/TestFlutterSecureStoragePlatform/TestFlutterSecureStoragePlatform.html This snippet shows the implementation of the TestFlutterSecureStoragePlatform constructor, which initializes the in-memory data store. ```dart TestFlutterSecureStoragePlatform(this.data); ``` -------------------------------- ### write Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage-class.html Encrypts and saves a key-value pair to secure storage. Platform-specific options can be provided. ```APIDOC ## write({required String key, required String? value, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions}) ### Description Encrypts and saves the `key` with the given `value`. ### Parameters - **key** (String) - Required - The key under which to store the value. - **value** (String?) - Required - The value to encrypt and store. - **iOptions** (AppleOptions) - Optional - Platform-specific options for iOS. - **aOptions** (AndroidOptions) - Optional - Platform-specific options for Android. - **lOptions** (LinuxOptions) - Optional - Platform-specific options for Linux. - **webOptions** (WebOptions) - Optional - Platform-specific options for Web. - **mOptions** (AppleOptions) - Optional - Platform-specific options for macOS. - **wOptions** (WindowsOptions) - Optional - Platform-specific options for Windows. ### Returns - Future ``` -------------------------------- ### write method Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage/write.html Encrypts and saves the `key` with the given `value`. If the key was already in the storage, its associated value is changed. If the value is null, deletes the associated value for the given `key`. `key` shouldn't be null. `value` required value `iOptions` optional iOS options `aOptions` optional Android options `lOptions` optional Linux options `webOptions` optional web options `mOptions` optional MacOs options `wOptions` optional Windows options Can throw a PlatformException. ```APIDOC ## write method ### Description Encrypts and saves the `key` with the given `value`. If the key was already in the storage, its associated value is changed. If the value is null, deletes the associated value for the given `key`. ### Method Signature `Future write({ required String key, required String? value, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions })` ### Parameters #### Required Parameters - **key** (String) - The key under which to store the value. Cannot be null. - **value** (String?) - The value to store. If null, the associated value for the key will be deleted. #### Optional Parameters - **iOptions** (AppleOptions?) - Optional iOS-specific options. - **aOptions** (AndroidOptions?) - Optional Android-specific options. - **lOptions** (LinuxOptions?) - Optional Linux-specific options. - **webOptions** (WebOptions?) - Optional Web-specific options. - **mOptions** (AppleOptions?) - Optional macOS-specific options. - **wOptions** (WindowsOptions?) - Optional Windows-specific options. ### Throws - **PlatformException**: Can be thrown if an error occurs during the platform operation. ``` -------------------------------- ### IOSOptions.toMap Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions-class.html Converts the options into a map representation. ```APIDOC ## toMap() ### Description Converts the options into a map representation. ### Returns `Map` - A map containing the options. ``` -------------------------------- ### Declare WindowsOptions wOptions Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage/wOptions.html Declare the WindowsOptions variable to configure platform-specific options for Windows. ```dart final WindowsOptions wOptions; ``` -------------------------------- ### AndroidOptions Constructors Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AndroidOptions-class.html Constructors for creating AndroidOptions instances with various configurations for secure storage on Android. ```APIDOC ## Constructors ### AndroidOptions Standard secure storage using AES-GCM with RSA OAEP key wrapping. ```dart AndroidOptions({ @Deprecated('EncryptedSharedPreferences is deprecated and will be removed in v11. The Jetpack Security library is deprecated by Google. Your data will be automatically migrated to custom ciphers on first access. Remove this parameter - it will be ignored.') bool encryptedSharedPreferences = false, bool resetOnError = true, bool migrateOnAlgorithmChange = true, bool migrateWithBackup = false, bool enforceBiometrics = false, KeyCipherAlgorithm keyCipherAlgorithm = KeyCipherAlgorithm.RSA_ECB_OAEPwithSHA_256andMGF1Padding, StorageCipherAlgorithm storageCipherAlgorithm = StorageCipherAlgorithm.AES_GCM_NoPadding, AndroidBiometricType biometricType = AndroidBiometricType.biometricOrDeviceCredential, @Deprecated('Use storageNamespace instead. sharedPreferencesName only isolates data storage; storageNamespace provides full isolation including KeyStore aliases and key storage.') String? sharedPreferencesName, String? preferencesKeyPrefix, String? storageNamespace, String? biometricPromptTitle, String? biometricPromptSubtitle, String? biometricPromptNegativeButton, }) ``` ### AndroidOptions.biometric Maximum security storage with optional biometric authentication. ```dart AndroidOptions.biometric({ @Deprecated('EncryptedSharedPreferences is deprecated and will be removed in v11. The Jetpack Security library is deprecated by Google. Remove this parameter - it will be ignored.') bool encryptedSharedPreferences = false, bool resetOnError = true, bool migrateOnAlgorithmChange = true, bool migrateWithBackup = false, bool enforceBiometrics = false, AndroidBiometricType biometricType = AndroidBiometricType.biometricOrDeviceCredential, @Deprecated('Use storageNamespace instead. sharedPreferencesName only isolates data storage; storageNamespace provides full isolation including KeyStore aliases and key storage.') String? sharedPreferencesName, String? preferencesKeyPrefix, String? storageNamespace, String? biometricPromptTitle, String? biometricPromptSubtitle, String? biometricPromptNegativeButton, }) ``` ``` -------------------------------- ### toMap Method Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions/toMap.html Converts the Windows options into a map representation. This method is intended to be overridden by subclasses to provide a specific mapping of their configuration properties. ```APIDOC ## toMap Method ### Description Converts the options into a map representation. This method is intended to be overridden by subclasses to provide a specific mapping of their configuration properties. ### Returns * A map containing the configuration options. ### Implementation ```dart @override Map toMap() => { 'useBackwardCompatibility': _useBackwardCompatibility.toString(), }; ``` ``` -------------------------------- ### Read Method Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/FlutterSecureStorage/read.html This snippet shows the implementation of the read method, which calls the platform-specific read function with the provided key and options. ```dart Future read({ required String key, AppleOptions? iOptions, AndroidOptions? aOptions, LinuxOptions? lOptions, WebOptions? webOptions, AppleOptions? mOptions, WindowsOptions? wOptions, }) => _platform.read( key: key, options: _selectOptions( iOptions, aOptions, lOptions, webOptions, mOptions, wOptions, ), ); ``` -------------------------------- ### toMap method Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WebOptions/toMap.html Converts the `WebOptions` instance into a map representation, including all web-specific properties. ```APIDOC ## toMap() ### Description Converts the `WebOptions` instance into a map representation, including all web-specific properties. ### Method ```dart Map toMap() ``` ### Returns A `Map` representing the `WebOptions` instance. ### Implementation Details This method serializes the following properties into the map: - `dbName` - `publicKey` - `wrapKey` - `wrapKeyIv` - `useSessionStorage` (converted to string) ### Example ```dart final options = WebOptions(dbName: 'myDb', useSessionStorage: true); final map = options.toMap(); // map will be {'dbName': 'myDb', 'publicKey': '', 'wrapKey': '', 'wrapKeyIv': '', 'useSessionStorage': 'true'} ``` ``` -------------------------------- ### LinuxOptions Properties Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions-class.html Details the properties available for the LinuxOptions class, including inherited ones. ```APIDOC ## Properties ### hashCode → int - **Description**: The hash code for this object. - **Inherited**: true ### params → Map - **Description**: A getter that retrieves the options as a map representation. - **Inherited**: true ### runtimeType → Type - **Description**: A representation of the runtime type of the object. - **Inherited**: true ``` -------------------------------- ### AndroidOptions Methods Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AndroidOptions-class.html Methods available on the AndroidOptions class for managing secure storage configurations. ```APIDOC ## Methods ### copyWith Creates a copy of this AndroidOptions with the given fields replaced. - **Parameters**: - `encryptedSharedPreferences` (bool?): New value for encryptedSharedPreferences. - `resetOnError` (bool?): New value for resetOnError. - `migrateOnAlgorithmChange` (bool?): New value for migrateOnAlgorithmChange. - `migrateWithBackup` (bool?): New value for migrateWithBackup. - `enforceBiometrics` (bool?): New value for enforceBiometrics. - `keyCipherAlgorithm` (KeyCipherAlgorithm?): New value for keyCipherAlgorithm. - `storageCipherAlgorithm` (StorageCipherAlgorithm?): New value for storageCipherAlgorithm. - `biometricType` (AndroidBiometricType?): New value for biometricType. - `preferencesKeyPrefix` (String?): New value for preferencesKeyPrefix. - `sharedPreferencesName` (String?): New value for sharedPreferencesName. - `storageNamespace` (String?): New value for storageNamespace. - `biometricPromptTitle` (String?): New value for biometricPromptTitle. - `biometricPromptSubtitle` (String?): New value for biometricPromptSubtitle. - `biometricPromptNegativeButton` (String?): New value for biometricPromptNegativeButton. - **Returns**: `AndroidOptions` - A new AndroidOptions instance with the updated fields. ### noSuchMethod Invoked when a nonexistent method or property is accessed. - **Parameters**: - `invocation` (Invocation): The invocation details. - **Returns**: `dynamic` ### toMap Converts the options into a map representation. - **Returns**: `Map` ### toString A string representation of this object. - **Returns**: `String` ``` -------------------------------- ### WindowsOptions copyWith Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions/copyWith.html Creates a new instance of WindowsOptions by copying the current instance and replacing specified properties with new values. Use this method to create modified configurations without altering the original object. ```dart WindowsOptions copyWith({ bool? useBackwardCompatibility, }) => WindowsOptions( useBackwardCompatibility: useBackwardCompatibility ?? _useBackwardCompatibility, ); ``` -------------------------------- ### toMap method Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AppleOptions/toMap.html Converts the AppleOptions configuration into a map. This method is intended to be overridden by subclasses to provide specific mapping for their configuration properties. ```APIDOC ## toMap() ### Description Converts the options into a map representation. This method is intended to be overridden by subclasses to provide a specific mapping of their configuration properties. ### Method `override` ### Returns * A map containing the configuration options. ### Implementation Details The method constructs a `Map` by conditionally including various properties of the `AppleOptions` class. These properties include `accountName`, `groupId`, `accessibility`, `label`, `description`, `comment`, `synchronizable`, `isInvisible`, `isNegative`, `creationDate`, `lastModifiedDate`, `resultLimit`, `shouldReturnPersistentReference`, `authenticationUIBehavior`, `accessControlFlags`, and `useSecureEnclave`. Dates are converted to ISO 8601 strings, and boolean values are converted to strings. The `accessControlFlags` are mapped to their names and then converted to a string representation of a list. ``` -------------------------------- ### Activate Melos Package Manager Source: https://pub.dev/documentation/flutter_secure_storage/latest/index.html Activate the melos package manager globally using dart pub global activate. ```bash dart pub global activate melos ``` -------------------------------- ### read method Source: https://pub.dev/documentation/flutter_secure_storage/latest/test_test_flutter_secure_storage_platform/TestFlutterSecureStoragePlatform/read.html Reads a value from secure storage by its key. It takes a required key and a map of platform-specific options. It returns a Future that resolves to the value or null if the key is not found. ```APIDOC ## read method ### Description Reads a value from secure storage by its key. ### Method Signature Future read({ required String key, required Map options, }) ### Parameters #### Path Parameters * `key` (string) - Required - The key of the value to retrieve. * `options` (Map) - Required - A map of platform-specific options for the read operation. ### Returns * A Future that resolves to the value associated with the key, or `null` if the key does not exist. ``` -------------------------------- ### LinuxOptions toMap Implementation Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/LinuxOptions/toMap.html Overrides the base Options.toMap method to provide a Linux-specific implementation. Returns an empty map as LinuxOptions requires no additional configuration. ```dart @override Map toMap() { return {}; } ``` -------------------------------- ### AndroidOptions Constructor Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/AndroidOptions/AndroidOptions.html The `AndroidOptions` constructor allows you to configure various security and migration settings for secure storage on Android. It supports default strong security settings and offers advanced customization for cipher algorithms and biometric authentication. ```APIDOC ## AndroidOptions Constructor ### Description Configures secure storage options for Android. This constructor provides default strong security settings and allows for customization of encryption algorithms, migration behavior, and biometric authentication. ### Parameters - **encryptedSharedPreferences** (bool) - Deprecated: Use `storageNamespace` instead. This parameter is ignored and will be removed in future versions. - **resetOnError** (bool) - Optional - If true, resets storage on encryption errors. Defaults to `true`. - **migrateOnAlgorithmChange** (bool) - Optional - If true, migrates data when encryption algorithms change. Defaults to `true`. - **migrateWithBackup** (bool) - Optional - If true, migrates data with a backup. Defaults to `false`. - **enforceBiometrics** (bool) - Optional - If true, enforces biometric authentication. Defaults to `false`. - **keyCipherAlgorithm** (KeyCipherAlgorithm) - Optional - The algorithm used for key protection. Defaults to `KeyCipherAlgorithm.RSA_ECB_OAEPwithSHA_256andMGF1Padding`. - **storageCipherAlgorithm** (StorageCipherAlgorithm) - Optional - The algorithm used for data encryption. Defaults to `StorageCipherAlgorithm.AES_GCM_NoPadding`. - **biometricType** (AndroidBiometricType) - Optional - The type of biometric authentication to use. Defaults to `AndroidBiometricType.biometricOrDeviceCredential`. - **sharedPreferencesName** (String?) - Deprecated: Use `storageNamespace` instead. Isolates data storage. - **preferencesKeyPrefix** (String?) - Optional - A prefix for storage keys. - **storageNamespace** (String?) - Optional - Provides full isolation for storage, including KeyStore aliases and key storage. - **biometricPromptTitle** (String?) - Optional - The title for the biometric prompt. - **biometricPromptSubtitle** (String?) - Optional - The subtitle for the biometric prompt. - **biometricPromptNegativeButton** (String?) - Optional - The text for the negative button on the biometric prompt. ### Default Usage Standard secure storage using AES-GCM with RSA OAEP key wrapping. ```dart const storage = FlutterSecureStorage( androidOptions: AndroidOptions(), ); ``` ### Advanced Usage (Custom Ciphers) Advanced users can customize cipher algorithms for specific use cases. Valid combinations include: - AES_CBC_PKCS7Padding storage + any key cipher - AES_GCM_NoPadding storage + RSA key ciphers (standard RSA wrapping) - AES_GCM_NoPadding storage + AES_GCM_NoPadding key (KeyStore-based, supports biometrics) ```dart const storage = FlutterSecureStorage( androidOptions: AndroidOptions( keyCipherAlgorithm: KeyCipherAlgorithm.RSA_ECB_PKCS1_OAEPWithSHA1AndMGF1Padding, storageCipherAlgorithm: StorageCipherAlgorithm.AES_CBC_PKCS7Padding, ), ); ``` ### Biometric Authentication For biometric authentication, use `AndroidOptions.biometric()` or configure `enforceBiometrics` and `biometricType`. ```dart const storage = FlutterSecureStorage( androidOptions: AndroidOptions.biometric(), ); ``` ``` -------------------------------- ### MacOsOptions Default Instance Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/MacOsOptions/defaultOptions-constant.html A predefined `MacosOptions` instance with default settings. This can be used as a fallback or when no specific options are required. ```dart static const MacOsOptions defaultOptions = MacOsOptions(); ``` -------------------------------- ### WindowsOptions Properties Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/WindowsOptions-class.html Details the properties available for the WindowsOptions class, including hash code, parameters map, and runtime type. ```APIDOC ## Properties ### hashCode ```dart int get hashCode ``` #### Description The hash code for this object. ### params ```dart Map get params ``` #### Description A getter that retrieves the options as a map representation. ### runtimeType ```dart Type get runtimeType ``` #### Description A representation of the runtime type of the object. ``` -------------------------------- ### IOSOptions Constructor Signature Source: https://pub.dev/documentation/flutter_secure_storage/latest/flutter_secure_storage/IOSOptions/IOSOptions.html Defines the signature of the IOSOptions constructor, listing all configurable parameters for keychain access and storage behavior on iOS. ```dart const IOSOptions({ 1. String? accountName = AppleOptions.defaultAccountName, 2. String? groupId, 3. KeychainAccessibility? accessibility = KeychainAccessibility.unlocked, 4. bool synchronizable = false, 5. String? label, 6. String? description, 7. String? comment, 8. bool? isInvisible, 9. bool? isNegative, 10. DateTime? creationDate, 11. DateTime? lastModifiedDate, 12. int? resultLimit, 13. bool? shouldReturnPersistentReference, 14. String? authenticationUIBehavior, 15. List accessControlFlags = const [], 16. bool useSecureEnclave = false, }) ```