LicensePlatePattern class abstract Extensibility
A pluggable license-plate validation strategy.
The core ships with UkPlatePattern (post-2001 format, which is stable nationwide). Plates from countries with heavy regional variation — US (per-state) and Canada (per-province) — are intentionally not built in; implement them per your use case or use extension packages.
V.string().licensePlate(patterns: [const UkPlatePattern()]);
class BrMercosulPattern extends LicensePlatePattern {
const BrMercosulPattern();
@override
String get name => 'BR Mercosul';
@override
bool matches(String value) =>
RegExp(r'^[A-Z]{3}\d[A-Z]\d{2}$').hasMatch(value);
}
See also:
- VString, which consumes patterns through its license-plate validator.
- UkPlatePattern, the only built-in implementation.
- Implementers
Constructors
- LicensePlatePattern()
-
Creates a LicensePlatePattern.
const
Properties
Methods
-
matches(
String value) → bool -
Returns
trueifvalueis a valid license plate for this pattern. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited