toJSON method

  1. @override
String? toJSON()
override

Converts the internal value of the field to a JSON representation.

Returns: A JSON representation of the internal value of the field.

Implementation

@override
String? toJSON() {
  if (isRequired && _value == null) {
    throw Exception("Field is required but has not been set a value");
  }
  return _value?.toIso8601String();
}