convertProfileDetailJsonFromString function

String convertProfileDetailJsonFromString(
  1. String? str
)

Converts a JSON string into a JSON string representing a single ProfileDetails object.

This function checks if the provided string is null or empty. If it is, it returns an empty string. Otherwise, it converts the string into a ProfileDetails object using profileDetailFromJson, and then back into a JSON string using profileDetailToJson.

Parameters: str - A JSON string or null.

Returns: A JSON string representing a single ProfileDetails object, or an empty string if the input is null or empty.

Implementation

String convertProfileDetailJsonFromString(String? str) =>
    (str == null || str.isEmpty)
        ? ""
        : profileDetailToJson(profileDetailFromJson(str));