gmana_validation 0.0.1 copy "gmana_validation: ^0.0.1" to clipboard
gmana_validation: ^0.0.1 copied to clipboard

Pure Dart typed validators for email, password, text, and number inputs using Either-based results.

example/main.dart

// ignore_for_file: avoid_print
import 'package:gmana_validation/gmana_validation.dart';

void main() {
  final email = const EmailValidator().validate(' User@Example.COM ');
  final password = const PasswordValidator().validate('StrongP@ssw0rd');
  final name = TextValidator(TextValidationConfig.required(minLength: 3, trimWhitespace: true)).validate('  Gmana  ');
  final quantity = NumberValidator(NumberValidationConfig.positiveInteger(min: 1, max: 99)).validate('12');
  final strength = PasswordStrength.of('StrongP@ssw0rd');

  print('Validation');
  print('  email: ${email.fold(resolveEmailValidationIssue, (value) => value)}');
  print('  password: ${password.fold(resolvePasswordValidationIssue, (_) => 'valid')}');
  print('  text: ${name.fold(resolveTextValidationIssue, (value) => value)}');
  print('  quantity: ${quantity.fold(resolveNumberValidationIssue, (value) => value)}');
  print('  password strength score: ${strength.score}/5');
  print('  unmet requirements: ${strength.unmetRequirements}');
}
0
likes
160
points
72
downloads

Documentation

API reference

Publisher

verified publishergmana.co

Weekly Downloads

Pure Dart typed validators for email, password, text, and number inputs using Either-based results.

Repository (GitHub)
View/report issues

Topics

#validation #either #form

License

MIT (license)

Dependencies

gmana_functional, gmana_predicates

More

Packages that depend on gmana_validation