Skip to content
pubscout

lucid_validation

1.4.0, released 5 months ago by flutterando.com.br

A pure Dart package for building strongly‑typed, fluent validation rules for models.

WASM-ready
$ flutter pub add lucid_validation
Source repository

What it does

It lets you define validation rules with a fluent API, supporting inline validators, rule sets, and polymorphic validation. The validator returns detailed results or throws exceptions on failure.

AI-written summary of version 1.4.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need compile‑time safety and autocomplete for validation logic
  • You want a reusable, chainable validator that works on both Flutter and server Dart

Skip it when

  • Simple required‑field checks where a full validator is overkill
  • Performance‑critical loops needing hand‑rolled checks

Strengths

  • Strongly typed with compile‑time checks
  • Fluent, expressive API with many built‑in validators
  • Supports inline validators, rule sets, and async rules

Weaknesses

  • No built‑in UI integration, you must map results yourself
  • Learning curve for the fluent API

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:lucid_validation/lucid_validation.dart';

class User{final String email;User(this.email);} 

class UserValidator extends LucidValidator<User>{
  UserValidator(){
    ruleFor((u)=>u.email,key:'email').notEmpty().validEmail();
  }
}

void main(){
  final validator=UserValidator();
  final result=validator.validate(User('test@example.com'));
  print(result.isValid);
}

Alternatives

Packages that do the same job and could replace lucid_validation.

Works with

Packages commonly used together with lucid_validation: ones it builds on, ones built on it, and its own family.