validated 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Validated #

The ultimate dart + flutter string validators . This library over 40 validators plus sanitizers . Check out the docs for all functions . You will find all the functions under validated package

Example #

import 'package:validated/validated.dart' as validate;

void main() {
  print(validate.isBoolean('a')); // false
  print(validate.isEmail("adib@gmail.com")); // true
  print(validate.isAscii("ABCDEF")); // false
  print(validate.isSameType('String', false)); // false
  print(validate.isUpperCase("ADIB")); // true
  print(validate.isCapital("Adib")); // true
  print(validate.contains("Dart is nice", "nice")); // true
  print(validate.isCurrency("\$")); // false
  print(validate.isURL('https://www.google.com')); // true
}

Credits #

1 . validator.js
2 . dart-validator
3 . email-validator

Todos #

  • [x] Ported validator.js to dart
  • [ ] emoji validator
  • [x] supports dart 2+ versions
  • [x] tested for flutter
  • [x] added docs

1.0.1 #

  • Fixed validators
  • analyzed using dartanalyzer

1.0.0 #

  • Added over 40 validators
  • added docs

example/example.dart

import 'package:validated/validated.dart' as validate;

void main() {
  print(validate.isBoolean('a'));
  print(validate.isEmail("adib@gmail.com"));
  print(validate.isAscii("ABCDEF"));
  print(validate.isSameType('String', false));
  print(validate.isUpperCase("ADIB"));
  print(validate.isCapital("Adib"));
  print(validate.contains("Dart is nice", "nice"));
  print(validate.isCurrency("\$"));
  print(validate.isURL('https://www.google.com'));
}

Use this package as a library

1. Depend on it

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


dependencies:
  validated: ^1.0.1

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:validated/validated.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
97
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

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

Health suggestions

Fix lib/src/gen.dart. (-0.50 points)

Analysis of lib/src/gen.dart reported 1 hint:

line 19 col 3: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix lib/src/isBase32.dart. (-0.50 points)

Analysis of lib/src/isBase32.dart reported 1 hint:

line 5 col 7: Use isNotEmpty instead of length

Fix lib/src/isBool.dart. (-0.50 points)

Analysis of lib/src/isBool.dart reported 1 hint:

line 3 col 11: Use contains instead of indexOf

Fix additional 3 files with analysis or formatting issues. (-1.50 points)

Additional issues in the following files:

  • lib/src/isFQDN.dart (1 hint)
  • lib/src/isNull.dart (1 hint)
  • lib/src/shift.dart (1 hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.36.0 <3.0.0
Dev dependencies
test >=0.12.18