platform/packages/validate/lib/src/context_validator.dart

16 lines
475 B
Dart
Raw Normal View History

2021-02-21 02:47:23 +00:00
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;
}