DateBefore.fromString constructor

DateBefore.fromString(
  1. String dateStr, {
  2. String? format = 'yyyy-MM-dd',
  3. String? message,
})

Creates a new instance of the DateBefore validation rule from a string representation.

  • dateStr: The date string to parse and compare against.
  • format: The format of the date string (default is 'yyyy-MM-dd').
  • message: A custom validation message (optional) to be displayed when the validation fails.

Implementation

DateBefore.fromString(String dateStr,
    {String? format = 'yyyy-MM-dd', String? message})
    : date = DateFormat(format).parse(dateStr),
      super(message);