utils/security/security library

Classes

AppBarSecurityConfig
ButtonSecurityConfig
OTPAttemptTracker
Rate limiter for OTP verification attempts.
OTPSecurityConfig
Security configuration for OTP/PIN input fields.
SearchBarSecurityConfig
Security configuration for SearchBar widgets.
SearchRateLimiter
Rate limiter for search queries to prevent abuse.
TextFieldSecurityConfig
Security configuration for TextField widgets.
TextSecurityConfig
Security configuration for Text widgets.

Extensions

SecureAppBarCallbackExtension on VoidCallback?
Extension to add security features to AppBar callbacks.
SecureCallbackExtension on VoidCallback?
Extension to add security features to VoidCallback.
SecureValueChangedExtension on ValueChanged<T>?
Extension for ValueChanged with safety.

Functions

safeAppBarCallback(VoidCallback? callback, {String? context}) → void
Safe callback execution for AppBar callbacks.
safeExecute(VoidCallback? callback, {String? context}) → void
safeExecuteAsync(Future<void> callback()?, {String? context}) Future<void>
safeOTPCallback(void callback(String)?, String value, {String context = 'OTP callback'}) → void
Safely executes an OTP callback with error handling.
safeOTPVoidCallback(VoidCallback? callback, {String context = 'OTP void callback'}) → void
Safely executes a void callback with error handling.
safeSearchCallback(void callback(String)?, String value, {String context = 'Search callback'}) → void
Safely executes a search callback with error handling.
safeSearchVoidCallback(VoidCallback? callback, {String context = 'Search void callback'}) → void
Safely executes a void callback with error handling.
safeTextCallback(VoidCallback? callback, {String context = 'Text callback'}) → void
Safely executes a text tap callback with error handling.
safeTextFieldCallback(void callback(String)?, String value, {String context = 'TextField callback'}) → void
Safely executes a text field callback with error handling.
safeTextFieldVoidCallback(VoidCallback? callback, {String context = 'TextField void callback'}) → void
Safely executes a void callback with error handling.
safeValueChanged<T>(ValueChanged<T>? callback, T value, {String? context}) → void
Safe value changed callback execution.
sanitizeButtonText(String? text, {int maxLength = 500, bool? enableSecurity}) String
Sanitize text input to prevent potential issues.
sanitizeHintText(String? text, {String defaultHint = 'Search...', bool? enableSecurity}) String
Sanitize hint text for search bars. Pass enableSecurity to override global setting, or leave null to use global.
sanitizeTitleText(String? text, {bool? enableSecurity}) String
Sanitize title text to prevent overflow and potential issues. Pass enableSecurity to override global setting, or leave null to use global.
validateActions<T>(List<T>? actions, {bool? enableSecurity}) List<T>?
Validate actions list is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateAppBarElevation(double? value, {required double defaultValue, bool? enableSecurity}) double
Validate elevation is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateAppBarHeight(double? value, {required double defaultValue, bool? enableSecurity}) double
Validate AppBar height is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateBorderRadius(double? value, {double? defaultValue, bool? enableSecurity}) double?
validateContentPadding(double? padding, {double? defaultValue, bool? enableSecurity}) double?
Validates content padding within configured bounds.
validateDebounceDuration(int? duration, {int defaultValue = 300, bool? enableSecurity}) int
Validates debounce duration within configured bounds.
validateDecorationThickness(double? thickness, {double? defaultValue, bool? enableSecurity}) double?
Validates decoration thickness within configured bounds.
validateElevation(double? value, {double? defaultValue, bool? enableSecurity}) double?
validateFontSize(double? value, {double? defaultValue, bool? enableSecurity}) double?
validateGradientColors(List<Color>? colors, {bool? enableSecurity}) List<Color>?
Validate gradient colors list. Pass enableSecurity to override global setting, or leave null to use global.
validateIconSize(double? value, {required double defaultValue, bool? enableSecurity}) double
Validate icon size is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateInputLength(int? length, {int? defaultValue, bool? enableSecurity}) int
Validates input length.
validateLabelSpacing(double? spacing, {double? defaultValue, bool? enableSecurity}) double?
Validates label spacing within configured bounds.
validateLetterSpacing(double? spacing, {double? defaultValue, bool? enableSecurity}) double?
Validates letter spacing within configured bounds.
validateLineHeight(double? height, {double? defaultValue, bool? enableSecurity}) double?
Validates line height within configured bounds.
validateMaxLines(int? maxLines, {int? defaultValue, bool? enableSecurity}) int
Validates max lines within configured bounds.
validateOTPBorderRadius(double? radius, {required double defaultValue, bool? enableSecurity}) double
Validates border radius within configured bounds.
validateOTPBorderWidth(double? width, {double defaultValue = 1.5, bool? enableSecurity}) double
Validates border width within configured bounds.
validateOTPFontSize(double? fontSize, {required double defaultValue, bool? enableSecurity}) double
Validates font size within configured bounds.
validateOTPLength(int? length, {int defaultValue = 6, bool? enableSecurity}) int
Validates OTP length within configured bounds. Returns the validated length.
validateOTPSpacing(double? spacing, {required double defaultValue, bool? enableSecurity}) double
Validates spacing between pins.
validatePinSize(double? size, {required double defaultValue, bool? enableSecurity}) double
Validates pin box size within configured bounds.
validateSearchBarBorderRadius(double? radius, {required double defaultValue, bool? enableSecurity}) double
Validates border radius within configured bounds.
validateSearchBarFontSize(double? fontSize, {required double defaultValue, bool? enableSecurity}) double
Validates font size within configured bounds.
validateSearchBarHeight(double? height, {required double defaultValue, bool? enableSecurity}) double
Validates search bar height within configured bounds.
validateSearchBarIconSize(double? size, {required double defaultValue, bool? enableSecurity}) double
Validates icon size within configured bounds.
validateSearchBarPadding(double? padding, {required double defaultValue, bool? enableSecurity}) double
Validates padding within configured bounds.
validateSearchQuery(String? query, {bool? enableSecurity}) String
Validates and sanitizes search query. Returns the validated query string.
validateSize(double? value, {double? defaultValue, double? min, double? max, bool? enableSecurity}) double?
validateSystemOverlayStyle(SystemUiOverlayStyle? style) SystemUiOverlayStyle?
Validate system overlay style for security.
validateTabs<T>(List<T> tabs, {bool? enableSecurity}) List<T>
Validate tabs list is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateTextContent(String? text, {bool? enableSecurity}) String
Validates and sanitizes text content. Returns the validated text string.
validateTextFieldBorderRadius(double? radius, {double? defaultValue, bool? enableSecurity}) double?
Validates border radius within configured bounds.
validateTextFieldBorderWidth(double? width, {double? defaultValue, bool? enableSecurity}) double?
Validates border width within configured bounds.
validateTextFieldFontSize(double? fontSize, {double? defaultValue, bool? enableSecurity}) double?
Validates font size within configured bounds.
validateTextFieldHeight(double? height, {double? defaultValue, bool? enableSecurity}) double
Validates height within configured bounds.
validateTextFieldIconSize(double? size, {double? defaultValue, bool? enableSecurity}) double?
Validates icon size within configured bounds.
validateTextFieldMaxLines(int? maxLines, {int defaultValue = 1, bool? enableSecurity}) int
Validates max lines within configured bounds.
validateTextFieldMinLines(int? minLines, {int defaultValue = 1, bool? enableSecurity}) int
Validates min lines within configured bounds.
validateTextFontSize(double? fontSize, {double? defaultValue, bool? enableSecurity}) double?
Validates font size within configured bounds.
validateTextScaleFactor(double? scaleFactor, {double? defaultValue, bool? enableSecurity}) double?
Validates text scale factor within configured bounds.
validateTextShadows(List<Shadow>? shadows, {bool? enableSecurity}) List<Shadow>?
Validates and limits shadow list.
validateTitleFontSize(double? value, {required double defaultValue, bool? enableSecurity}) double
Validate title font size is within bounds. Pass enableSecurity to override global setting, or leave null to use global.
validateWordSpacing(double? spacing, {double? defaultValue, bool? enableSecurity}) double?
Validates word spacing within configured bounds.