platform/packages/validation/lib/src/context_validator.dart
2024-12-15 12:58:42 -07:00

15 lines
475 B
Dart

import 'package:matcher/matcher.dart';
/// A [Matcher] directly invoked by `package:angel_serialize` to validate the context.
class ContextValidator extends Matcher {
final bool Function(String, Map) validate;
final Description Function(Description, String, Map) errorMessage;
ContextValidator(this.validate, this.errorMessage);
@override
Description describe(Description description) => description;
@override
bool matches(item, Map matchState) => true;
}