convertAudioDevicesToJson function

String convertAudioDevicesToJson(
  1. String? str
)

Converts a JSON string to a JSON string of AudioDevices, or returns an empty string if null or empty.

This function is a convenience wrapper around audioDevicesFromJson and audioDevicesToJson, providing a quick way to convert a JSON string back to a JSON string after checking for null or emptiness.

str: The JSON string to be converted.

Returns a JSON string of AudioDevices if str is not null or empty; otherwise, returns an empty string.

Implementation

String convertAudioDevicesToJson(String? str) => (str == null || str.isEmpty)
    ? ""
    : audioDevicesToJson(audioDevicesFromJson(str));