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

outdated

Validation Chain API.

Validation Chain #

A validation chain api to use with TextFormField or Backend applicaitons made with dart. #

Usage #

import 'package:validation_chain/validation_chain.dart';

String? compulsory(String value) {
  return value.isEmpty ? 'Required' : null;
}

String? tooShort(String value) {
  return value.length < 5 ? 'Too Short' : null;
}

String? tooLong(String value) {
  return value.length > 10 ? 'Too Long' : null;
}

final validationChain = ValidationChain([
    compulsory,
    tooShort,
    tooLong,
]);
    
validationChain.validate('');               // 'Required'
validationChain.validate('Hey');            // 'Too Short'
validationChain.validate('Hello');          // null
validationChain.validate('Hello World');    // 'Too Long'
14
likes
0
points
138
downloads

Publisher

unverified uploader

Weekly Downloads

Validation Chain API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on validation_chain