Skip to content

Validating a Bool value

import 'package:luthor/luthor.dart';
void main() {
final validator = l.bool();
print(validator.validateValue(true));
}
import 'package:luthor/luthor.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'bool_schema.freezed.dart';
part 'bool_schema.g.dart';
@freezed
@luthor
class BoolSchema extends _$BoolSchema {
const factory BoolSchema({
required bool value,
}) = _$BoolSchema;
static SchemaValidationResult<BoolSchema> validate(
Map<String, dynamic> json,
) =>
_$BoolSchemaValidate(json);
factory BoolSchema.fromJson(Map<String, dynamic> json) =>
_$BoolSchemaFromJson(json);
}
void main() {
print(BoolSchema.validate({'value': true}));
}