validate 1.7.0

  • Readme
  • Changelog
  • Installing
  • 75

Validate #

Lightweight library for validating function arguments in Dart.

This library is mainly a port of Apaches org.apache.commons.lang3.Validate class

Validation is necessary on most public-facing APIs. Parameter validation on non-public methods is not as important - it is often desirable to have validation occur only once, at the public 'entry point' - but if you can live with the potential performance hit, I recommend to validate parameters everywhere, as it makes code maintenance and refactoring a bit easier.

For further documentation please refere to the Unit-Tests.

History #

  • 1.4.0 - Instance check added
  • 1.3.0 - Validate.isUUID added
  • 1.2.7 - Removed debug info from URIBuilder
  • 1.2.4 - Runs with Dart 1.1 + IntelliJ 13
  • 1.2.0 - isKeyInMap check added
  • 1.1.0 - isJson check added
  • 1.0.5 - Changed GitHub-Repository to dart-validate
  • 1.0.4 - Replaced NullPointerException with ArgumentError - makes more sense

You can see further changes on the CHANGELOG!

License #

Copyright 2018 Michael Mitterer, IT-Consulting and Development Limited,
Austrian Branch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on an 
either express or implied. See the License for the specific language 
governing permissions and limitations under the License.

If this plugin is helpful for you - please (Circle) me.

Change Log for validate #

This class assists in validating method arguments

v1.7 - 2018-08-21 #

Feature #

  • Support for GMAIL infinite mailboxes (PATTERN_EMAIL) changed. Closes #3 4af87cb

v1.5.4 - 2017-01-31 #

Docs #

v1.5.3 - 2016-11-16 #

Docs #

v1.5.2 - 2016-07-14 #

Docs #

  • isKeyInMap shows Map as JSON-Structure 471c4e2

v1.5.1 - 2015-12-08 #

Docs #

v1.5.0 - 2015-12-08 #

Feature #

  • Changed to 'test', improved password-pattern 13e0926

Docs #

  • Grinder + new test format 965fa08

This was generated with Changelog for Dart

Use this package as a library

1. Depend on it

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

  validate: ^1.7.0

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

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/validate.dart. (-14.39 points)

Analysis of lib/validate.dart reported 31 hints, including:

line 51 col 1: Prefer using /// for doc comments.

line 79 col 44: Avoid const keyword.

line 90 col 5: Prefer using /// for doc comments.

line 108 col 5: Prefer using /// for doc comments.

line 135 col 5: Prefer using /// for doc comments.

Fix lib/src/utils.dart. (-1.49 points)

Analysis of lib/src/utils.dart reported 3 hints:

line 27 col 37: Use = to separate a named parameter from its default value.

line 34 col 70: Unnecessary new keyword.

line 34 col 109: Unnecessary new keyword.

Fix lib/expect.dart. (-1 points)

Analysis of lib/expect.dart reported 2 hints:

line 12 col 15: Unnecessary new keyword.

line 19 col 15: Unnecessary new keyword.

Format lib/src/errors.dart.

Run dartfmt to format lib/src/errors.dart.

Maintenance issues and suggestions

Use analysis_options.yaml. (-10 points)

Change the name of your package's .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

Package is getting outdated. (-61.92 points)

The package was last published 84 weeks ago.

The package description is too short. (-11 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and validate.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
build_runner any
build_test any
build_web_compilers any
console_log_handler ^1.0.0
grinder any
test any