import 'package:luthor/luthor.dart'; void main() { final intValidator = l.int().min(42); final doubleValidator = l.double().min(42.0); final numberValidator = l.number().min(42); print(intValidator.validateValue(42)); print(doubleValidator.validateValue(42.0)); print(numberValidator.validateValue(42));}
import 'package:luthor/luthor.dart';import 'package:freezed_annotation/freezed_annotation.dart'; part 'number_min_schema.freezed.dart';part 'number_min_schema.g.dart'; @freezed@luthorclass NumberMinSchema extends _$NumberMinSchema { const factory NumberMinSchema({ @HasMin(42) required int intValue, @HasMinDouble(42.0) required double doubleValue, @HasMinNumber(42) required num numValue, }) = _$NumberMinSchema; static SchemaValidationResult<NumberMinSchema> validate( Map<String, dynamic> json, ) => _$NumberMinSchemaValidate(json); factory NumberMinSchema.fromJson(Map<String, dynamic> json) => _$NumberMinSchemaFromJson(json);} void main() { print(NumberMinSchema.validate({ 'intValue': 42, 'doubleValue': 42.0, 'numValue': 42, }));}