regexed_validator 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

Validating:

  • phone
  • name
  • postalCode
  • email
  • url
  • currency
  • ip
  • date
  • time
  • htmlTags
  • password
  • creditCard

For Dart/Flutter developers. Regexed Validator at pub.dartlang.org

Usage #

Usage is pretty simple just pass a phone, date, email... to its validation method, see the example below

import 'package:regexed_validator/regexed_validator.dart';

main() {
  print( validator.email('example@example.co.uk') ); // true

  print(validator.url('http://www.nowhere.com?product=28&color=blue')); // true

  print(validator.currency('£498.10')); // true

  print(validator.ip('67.52.159.38')); // true
  
  print(validator.time('14:34 GMT -5')); // true

  print( validator.htmlTags('<strong>Bold</strong>\n'
          '<em>Emphazied</em>\n'
          '<b>Bold</b>\n'
          '<i>Italics</i>\n'
          '<span id="foo" class="bar">Some text</span>\n'
          '<hr />')
  ); // true
}

1.0.2 #

  • Update README.md usage example and lib description
  • Update CHANGELOG.md
  • Update pubspec.yaml description

1.0.1 #

  • dartfmt

1.0.0 #

  • Initial version, created with basic yet functional phone, name, postalCode, email, url, currency, ip, date, time, htmlTags, password, and creditCard validation.

example/main.dart

import 'package:regexed_validator/regexed_validator.dart';

main() {
  print(validator.phone('+(123) - 456-78-90')); // true
  print(validator.name('John Quincy Adams')); // true
  print(validator.postalCode('10010-6543')); // ture
  print(validator.email('example@example.co.uk')); // true
  print(validator.url('http://www.nowhere.com?product=28&color=blue')); // true
  print(validator.currency('£498.10')); // true
  print(validator.ip('67.52.159.38')); // true
  print(validator.date('2000-12-20')); // true
  print(validator.time('14:34 GMT -5')); // true
  print(validator.htmlTags('<strong>Bold</strong>\n'
      '<em>Emphazied</em>\n'
      '<b>Bold</b>\n'
      '<i>Italics</i>\n'
      '<span id="foo" class="bar">Some text</span>\n'
      '<hr />')); // true
  print(validator.password('sword#42Fish')); // true
  print(validator.creditCard('4000-1234-1234-1234')); // true
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  regexed_validator: ^1.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:regexed_validator/regexed_validator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
82
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

We analyzed this package on Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:regexed_validator/regexed_validator.dart.

Health issues and suggestions

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0