convertProfileJsonFromString function
Converts a nullable JSON string into a non-nullable JSON string representing a ProfileModel.
If the input string is null or empty, this function returns an empty string. Otherwise, it decodes the string into a ProfileModel object using profileDataFromJson, and then serializes the object back into a JSON string using profileDataToJson.
str
: The nullable JSON string to convert.
Returns a non-nullable JSON string.
Implementation
String convertProfileJsonFromString(String? str) => (str == null || str.isEmpty)
? ""
: json.encode(profileDataFromJson(str).toJson());