value property

String? get value

CEP as a digit-only value — without the hyphen '-'.

There are three scenarios for a CEP value. If it is:

  1. properly masked as '#####-###', then the hyphen "-" will be removed from it (e.g., '13349-070' becomes '13349070').
  2. composed entirely of 8 numbers, then it will remain unchanged (e.g., '1334070' remains as is).
  3. malformed, then the null value will be returned to indicate a formatting error (e.g., '13349-00' becomes null).

Implementation

String? get value => _isWellFormed ? _strip : null;