boolean_validation

Creator: coderz1093

Last updated:

0 purchases

boolean_validation Image
boolean_validation Images

Languages

Categories

Add to Cart

Description:

boolean validation

boolean_validation #
A Dart package providing various validation utilities for common data types.
Validation Functions #



Function
Description
Example Usage




validateEmail
Validates if a string is a properly formatted email.
validateEmail('[email protected]')


validateMobileNumber
Validates if a string is a valid mobile number.
validateMobileNumber('1234567890')


validateInteger
Validates if a string is a valid integer.
validateInteger('123')


validateUrl
Validates if a string is a properly formatted URL.
validateUrl('http://example.com')


validateDate
Validates if a string is a valid date (YYYY-MM-DD).
validateDate('2020-01-01')


validateCreditCard
Validates if a string is a valid credit card number.
validateCreditCard('4111111111111111')


validateUsername
Validates if a string is a valid username.
validateUsername('username_123')



Usage #
Add the following to your pubspec.yaml:
dependencies:
boolean_validation: ^0.0.1
copied to clipboard
Import the package in your Dart file:
import 'package:boolean_validation/boolean_validation.dart';

void main() {
final Validators validators = Validators();

// Example: Validate Email
String? emailValidation = validators.validateEmail(
'[email protected]', 'Email is required', 'Invalid email');
print(emailValidation); // Output: null (indicating valid email)
}
copied to clipboard
Validators Class #
validateEmail #
String? validateEmail(String? value, String? emailRequiredMessage, String? validEmailMessage);
copied to clipboard

Description: Validates if the given string is a properly formatted email.
Parameters:

value: The email string to validate.
emailRequiredMessage: Custom message when email is required but not provided.
validEmailMessage: Custom message when email format is invalid.


Returns: Error message if invalid, null if valid.

validateMobileNumber #
String? validateMobileNumber(String? value, String? mobileRequiredMessage,
String? validMobileMessage);
copied to clipboard

Description: Validates if the given string is a valid mobile number.
Parameters:

value: The mobile number string to validate.
mobileRequiredMessage: Custom message when mobile number is required but not provided.
validMobileMessage: Custom message when mobile number format is invalid.


Returns: Error message if invalid, null if valid.

validateInteger #
String? validateInteger(String? value, String? integerRequiredMessage);
copied to clipboard

Description: Validates if the given string is a valid integer.
Parameters:

value: The integer string to validate.
integerRequiredMessage: Custom message when integer is required but not provided.


Returns: Error message if invalid, null if valid.

validateUrl #
String? validateUrl(String value, String? urlRequiredMessage, String? validUrlMessage);
copied to clipboard

Description: Validates if the given string is a properly formatted URL.
Parameters:

value: The URL string to validate.
urlRequiredMessage: Custom message when URL is required but not provided.
validUrlMessage: Custom message when URL format is invalid.


Returns: Error message if invalid, null if valid.

validateDate #
String? validateDate(String value, String? dateRequiredMessage, String? validDateMessage);
copied to clipboard

Description: Validates if the given string is a valid date in YYYY-MM-DD format.
Parameters:

value: The date string to validate.
dateRequiredMessage: Custom message when date is required but not provided.
validDateMessage: Custom message when date format is invalid.


Returns: Error message if invalid, null if valid.

validateCreditCard #
String? validateCreditCard(String value, String? cardRequiredMessage, String? validCardMessage);
copied to clipboard

Description: Validates if the given string is a valid credit card number.
Parameters:

value: The credit card number string to validate.
cardRequiredMessage: Custom message when credit card number is required but not provided.
validCardMessage: Custom message when credit card number is invalid.


Returns: Error message if invalid, null if valid.

validateUsername #
String? validateUsername(String value, String? usernameRequiredMessage,
String? validUsernameMessage);
copied to clipboard

Description: Validates if the given string is a valid username.
Parameters:

value: The username string to validate.
usernameRequiredMessage: Custom message when username is required but not provided.
validUsernameMessage: Custom message when username format is invalid.


Returns: Error message if invalid, null if valid.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.