toJson method
Serializes the string value to JSON format.
Returns the raw string value, which may be null if no value has been
set. This allows the JSON representation to distinguish between an
explicitly set empty string "" and an unset (null) value.
Returns:
The string value, or null if no value has been set.
Example:
final field = JsonString('name');
print(field.toJson()); // null
field.value = 'John';
print(field.toJson()); // 'John'
field.value = '';
print(field.toJson()); // '' (empty string)
Implementation
@override
String? toJson() {
return rawValue;
}