ovo 0.0.0 copy "ovo: ^0.0.0" to clipboard
ovo: ^0.0.0 copied to clipboard

OvO is a Dart-first schema declaration and validation library.

OvO

OvO is a Dart-first schema declaration and validation library.

Introduction #

OvO is a Dart-first schema declaration and validation library. We use the technical term "Schema" to define any data type, from simple single data (for example: string/int, etc.) to complex nested Map.

OvO is designed to be as user-friendly and developer-friendly as possible, with the goal of eliminating tedious type checking and object deserialization. It is easy to compose complex data structure validation using simple declaration validation.

several important aspects

  • A fun walkthrough of Dart type extensions
  • Simple and chained interface calls
  • Can be used on any Dart platform (Dart, Web, Flutter)

Installation #

We are more aggressive and use higher versions of Dart stable versions as much as possible.

Install from command line #

dart pub add ovo

Install from pubspec.yaml #

dependencies:
  ovo: latest

Basic Usage #

Create a simple string schema:

import 'package:ovo/ovo.dart' as ovo;

// Create a schema for string.
final schema = ovo.string();

// Parsing
await schema.parse('Hello World'); // => 'Hello World'
await schema.parse(123); // => throws OvoError

// Safe parsing, don't throw error.
await schema.safeParse('Hello World'); // => OvoSuccess<String>('Hello World')
await schema.safeParse(123); // => OvoFailure<String>('Expected a string, but received a int')

Creating an JSON schema:

import 'package:ovo/ovo.dart' as ovo;

final schema = ovo.json({
    'name': ovo.string(),
});

await schema.parse({
    'name': 'John',
}); // => {'name': 'John'}
4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

OvO is a Dart-first schema declaration and validation library.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on ovo