validasi 0.0.4 copy "validasi: ^0.0.4" to clipboard
validasi: ^0.0.4 copied to clipboard

An easy to use and flexible validation library for Dart and Flutter. Easily validate your forms input with built-in rules or create your own.

Validasi #

image

A flexible and straightforward Dart Validation Library.

Documentation API Documentation

Installation #

Add validasi to your pubspec dependencies or use pub get.

Quick Usage #

To use the library, simply import the package and use Validasi class to access to available validator.

import 'package:validasi/validasi.dart';

void main(List<String> args) {
  var schema = Validasi.string().maxLength(255);

  var result = schema.parse(args.firstOrNull);

  print("Hello! ${result.value}");
}

Supported Validations #

  • String
  • Numeric
  • Date
  • List
  • Map
  • Generic

Features #

  • Handling Type Conversion using Transformer

Validasi takes dynamic input and allows you to put any type of data. It will automatically convert the data into the desired type using Transformer.

  • Safe Validation

Validasi provide tryParse or tryParseAsync method to validate the input data. It will return Result object that contains the validation result without throwing any exception related to rule failing.

  • Custom Rule

You can create your own custom rule to be used in the Validator by simply using custom and customFor method.

  • Helpers

Validasi also provide some helper classes to help you organize and capture the validation result to be passed on Flutter's FormField.

License #

The Validasi Library is licensed under MIT License.

Contribution #

You can use below script to spin up development environment for this library base:

# Clone the repo
git clone https://github.com/albetnov/validasi
# Install the dependencies
dart pub get

The Tests in test/ directory are mapped 1:1 to lib and src folder. So their structure are similar.

The docs/ directory contains the documentation for the library, You would need Deno 2.0. You can run the documentation locally by using below command:

deno i
deno run docs:dev

Alternatively, you could use your package manager to just execute vitepress command:

npx vitepress dev doc
bunx vitepress dev doc
pnpm dlx vitepress dev doc
0
likes
150
points
99
downloads

Publisher

verified publisheralbetnv.me

Weekly Downloads

An easy to use and flexible validation library for Dart and Flutter. Easily validate your forms input with built-in rules or create your own.

Homepage
Repository (GitHub)
View/report issues

Topics

#validation #form

Documentation

API reference

License

MIT (license)

Dependencies

email_validator, intl, meta

More

Packages that depend on validasi