json_schema_builder
0.1.7, released 3 months ago by labs.flutter.dev
Build and validate JSON Schemas in Dart with a fluent, type‑safe API
WASM-ready
What it does
It lets you programmatically create JSON Schema 2020‑12 documents and validate data against them. The library handles schema references, remote fetching, and detailed error reporting.
AI-written summary of version 0.1.7, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to validate structured data against a JSON Schema in a Dart/Flutter app
- You want a standard‑compliant schema builder without writing raw JSON
- You need synchronous validation for performance or offline use
Skip it when
- You only need simple type checks and prefer built‑in Dart validation
- You are already using a code‑generation approach for JSON models
Strengths
- Full Draft 2020‑12 support
- Fluent, type‑safe API
- Synchronous validation path
- Rich error reporting
Weaknesses
- No code generation integration
- Requires manual schema construction
- Not a UI form builder
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
Add dependency via pubspec, import package, no build_runner needed
import 'package:json_schema_builder/json_schema_builder.dart';
final schema = S.object(properties:{'name':S.string()});
final errors = await schema.validate({'name':123});Alternatives
Packages that do the same job and could replace json_schema_builder.
- json_serializable
Generate Dart classes from JSON schemas instead of manual schema construction
94Compare
Works with
Packages commonly used together with json_schema_builder: ones it builds on, ones built on it, and its own family.
- argsjson_schema_builder depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- loggingjson_schema_builder depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- charactersjson_schema_builder depends on itUnicode and grapheme cluster aware string manipulation operations for Dart.
- decimaljson_schema_builder depends on itArbitrary-precision decimal arithmetic for Dart
- email_validatorjson_schema_builder depends on itA simple Dart class for validating email addresses without using RegEx.
- genuiBuilt on json_schema_builderGenerates and displays dynamic user interfaces in Flutter using AI.
- a2ui_coreBuilt on json_schema_builderFramework-agnostic Dart SDK for the A2UI protocol supporting messages, data binding, and state models.
- schemanticBuilt on json_schema_builderGenerate type-safe data classes and runtime JSON Schemas from abstract class definitions.