DateOfBirthValidator class

A utility class for validating a date of birth and calculating exact age.

Constructors

DateOfBirthValidator()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Methods

calculateAge(DateTime birthDate, {bool useUtc = false}) AgeResult
Calculates the exact age from a date of birth.
validate(dynamic dob, {String format = "yyyy-MM-dd", int minAgeYears = 18, int maxAgeYears = 120, int? minAgeDays, bool useUtc = false, String? invalidFormatMessage, String? futureDateMessage, String? tooYoungMessage, String? tooOldMessage}) String?
Validates a date of birth string or DateTime and returns an error message if invalid.