convertAvailableFeaturesToJson function
Converts a nullable JSON string to a JSON string representation of an AvailableFeatures object, or an empty string if null or empty.
This function checks if the input string is null or empty. If it is, it returns an empty string. Otherwise, it converts the string to an AvailableFeatures object and then back to a JSON string.
str
: The nullable JSON string to be converted.
Returns a JSON string representation of the AvailableFeatures object if str
is not null or empty; otherwise, returns an empty string.
Implementation
String convertAvailableFeaturesToJson(String? str) =>
(str == null || str.isEmpty)
? ""
: availableFeaturesToJson(availableFeaturesFromJson(str));