modelToViewValue method

  1. @override
String? modelToViewValue(
  1. DateTime? modelValue
)

Returns the value that must be supplied to the UI widget.

Converts value from control data type to UI data type.

Implementation

@override
String? modelToViewValue(DateTime? modelValue) {
  final dobAge = accessor.modelToViewValue(modelValue);
  if (dobAge == null || (dobAge.years == 0 && dobAge.months == 0)) {
    existingMonth = '';
    existingDays = '';
    return null;
  }

  existingMonth = dobAge.months.toString();
  existingDays = dobAge.days.toString();
  return dobAge.years.toString();
}