Validating a string is a specific length
import 'package:luthor/luthor.dart';
void main() { final validator = l.string().length(5); print(validator.validateValue('Hello'));}import 'package:luthor/luthor.dart';import 'package:freezed_annotation/freezed_annotation.dart';
part 'length.freezed.dart';part 'length.g.dart';
@luthor@freezedabstract class LengthSchema with _$LengthSchema { const factory LengthSchema({ @HasLength(5) required String value, }) = _LengthSchema;
factory LengthSchema.fromJson(Map<String, dynamic> json) => _$LengthSchemaFromJson(json);}
void main() { final result = $LengthSchemaValidate({'value': 'Hello'});
switch (result) { case SchemaValidationSuccess(data: final data): print('✅ Valid: ${data.value}'); case SchemaValidationError(errors: final errors): print('❌ Errors: $errors'); }}