Secure class
Annotates a field to be stored securely via FlutterSecureStorage.
Best for: Bearer tokens, API credentials, and PII (Personally Identifiable Information). Security: Uses Keychain (iOS), KeyStore (Android), and SecretService/libsecret (Linux).
Deep Implementation Detail
Unlike SharedPreferences, secure storage operations are asynchronous by nature
in the underlying OS. The generated system handles this by providing
immediate in-memory reactive access via ValueNotifier, while the
persistence to disk happens in the background.
Complex Scenario: Token Refresh
@GeneratePreferences()
class SecurePrefs extends BasePreferences with _$SecurePrefs {
@Secure('jwt_token')
late final String? _token;
}
Properties
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