convertMessageDeliveredStatusToJson function
Converts a nullable JSON string to a MessageStatusDetail object or an empty string.
This function checks if the provided JSON string is null or empty. If it is, the function returns an empty string; otherwise, it parses the JSON string into a MessageStatusDetail object and then converts it back to a JSON string.
Parameters:
str
- A nullable JSON string representing the message delivery status.
Returns: A JSON string representation of the MessageStatusDetail object or an empty string if the input is null or empty.
Implementation
String convertMessageDeliveredStatusToJson(String? str) =>
(str == null || str.isEmpty)
? ""
: messageDeliveredStatusToJson(messageDeliveredStatusFromJson(str));