string_validator 1.1.0 copy "string_validator: ^1.1.0" to clipboard
string_validator: ^1.1.0 copied to clipboard

Dart library for validating and sanitizing strings, especially those from user input.

example/example.dart

import 'package:string_validator/string_validator.dart';

void main() {
  String userInput = 'http://localhost:61500this is an invalid url!!!!';
  bool isValid = isURL(userInput); // false
  print(isValid);

  userInput = 'me@example.com';
  isValid = isEmail(userInput); // true
  print(isValid);

  userInput = 'password1';
  isValid = isLength(userInput, 12); // false
  print(isValid);

  //Using extension methods
  userInput = 'http://localhost:61500this is an invalid url!!!!';
  isValid = userInput.isURL(); // false
  print(isValid);

  userInput = 'me@example.com';
  isValid = userInput.isEmail; // true
  print(isValid);

  userInput = 'password1';
  isValid = userInput.isLength(12); // false
  print(isValid);
}
419
likes
160
pub points
98%
popularity

Publisher

verified publishersuragch.dev

Dart library for validating and sanitizing strings, especially those from user input.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

More

Packages that depend on string_validator