Skip to main content

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

Pure Dart typed validators and extensions for common input, identifier, network, and date formats.

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
104
downloads

Documentation

API reference

Publisher

verified publishergmana.co

Weekly Downloads

Pure Dart typed validators and extensions for common input, identifier, network, and date formats.

Repository (GitHub)
View/report issues
Contributing

Topics

#validation #either #form #extensions

License

MIT (license)

Dependencies

gmana_functional, gmana_predicates, meta

More

Packages that depend on gmana_validation