---
title: Overview
---
Ack is a schema validation library for Dart and Flutter that helps you validate data with a simple, fluent API. Ack is short for "acknowledgment".

## Why Use Ack?

- **Simplify Validation**: Easily handle complex data validation logic.
- **Ensure Data Integrity**: Guarantee data consistency from external sources (APIs, user input).
- **Single Source of Truth**: Define data structures and rules in one place.
- **Reduce Boilerplate**: Minimize repetitive validation code.

## What Ack Does

- Validates data against defined schemas
- Provides detailed error messages for validation failures
- Generates JSON Schema specifications
- Works seamlessly with JSON data from APIs

## Quick Start

Add Ack to your project:

```bash
dart pub add ack
```

### Basic Usage

```dart
import 'package:ack/ack.dart';

// Define the structure and rules for a user object.
final userSchema = Ack.object({
  'name': Ack.string().minLength(2).maxLength(50), // Name must be a string between 2 and 50 chars.
  'age': Ack.integer().min(0).max(120),            // Age must be an integer between 0 and 120.
  'email': Ack.string().email().nullable(),        // Email must be a valid format, but can be null.
}); // All fields are required by default

// Data to validate.
final dataToValidate = {
  'name': 'John',
  'age': 30,
  'email': 'john@example.com'
};

// Perform the validation against the schema.
final result = userSchema.safeParse(dataToValidate);

// Check the validation outcome.
if (result.isOk) {
  // Validation passed, safely access the validated data.
  final validData = result.getOrThrow();
  print('Valid data: $validData');
} else {
  // Validation failed, access the detailed error.
  final error = result.getError();
  print('Validation Error: $error'); // Use error.toString() for full details.
}
```

## Core Features

Ack provides a comprehensive set of features for data validation and transformation:

- **[Schema Types](/core-concepts/schemas)**: Define data structures with strings, numbers, booleans, lists, objects, and more
- **[Validation Rules](/core-concepts/validation)**: Apply constraints like length, range, pattern matching, and custom validators
- **[Error Handling](/core-concepts/error-handling)**: Get detailed, structured error messages for validation failures
- **[JSON Serialization](/core-concepts/json-serialization)**: Convert between JSON and typed models
- **[Configuration](/core-concepts/configuration)**: Schema-level configuration options

## Next Steps

Ready to dive deeper? Start with the [Quickstart Tutorial](/getting-started/quickstart-tutorial) for a step-by-step guide, or explore specific topics:

- [Schema Types](/core-concepts/schemas) - Learn about all available schema types
- [Validation Rules](/core-concepts/validation) - Master validation constraints
- [Error Handling](/core-concepts/error-handling) - Handle validation errors effectively
- [Flutter Integration](/guides/flutter-form-validation) - Validate Flutter forms

## Advanced Features

Ack provides powerful features for complex validation scenarios:

- **[Nested validation](/core-concepts/schemas#object)**: Validate deeply nested objects and lists
- **[Custom validation](/guides/custom-validation)**: Add custom logic with `.refine()` and constraints
- **[Union types](/core-concepts/schemas#union-types)**: Handle polymorphic data with `anyOf()` and discriminated unions
- **[Data transformation](/core-concepts/schemas#transformations)**: Transform validated data with `.transform()`
- **[JSON Schema generation](/guides/json-schema-integration)**: Generate JSON Schema specs for API documentation

For detailed examples and usage patterns, see the [Common Recipes guide](/guides/common-recipes).
