easy_data_validator 1.0.1 copy "easy_data_validator: ^1.0.1" to clipboard
easy_data_validator: ^1.0.1 copied to clipboard

Easy Validator is a text validation library for Dart/Flutter developed in Dart

example/lib/main.dart

import 'package:easy_data_validator/easy_data_validator.dart';

void main() {
  final isValid = Validator(text: "email@gmail.com")
      .addRule(NonEmptyRule())
      .addRule(NonNumbersRule())
      .addRule(EmailRule())
      .check();

  print("isValid => $isValid");

  final isValidPassword = Validator(text: "Passw0rd#Suc2021")
      .addRule(NonEmptyRule())
      .addRule(MinLengthRule(minLength: 8))
      .addRule(AtLeastOneUppercaseRule())
      .addRule(AtLeastOneSpecialCharacterRule())
      .addRule(AtLeastOneNumberRule())
      .addErrorCallback((msg) => print(msg))
      .addSuccessCallback(() => print("validation successful"))
      .check();

  print("isValidPassword => $isValidPassword");

  final wrongPassword = Validator(text: "Passw0rdSuc2021")
      .addRule(NonEmptyRule())
      .addRule(MinLengthRule(minLength: 8))
      .addRule(AtLeastOneUppercaseRule())
      .addRule(AtLeastOneSpecialCharacterRule())
      .addRule(AtLeastOneNumberRule())
      .addErrorCallback((msg) => print(msg))
      .addSuccessCallback(() => print("validation successful"))
      .check();

  print("wrongPassword => $wrongPassword");
}
2
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Easy Validator is a text validation library for Dart/Flutter developed in Dart

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on easy_data_validator