optString function
Calls through to {@link JSONObject#optString(String)} while safely converting the raw string "null" and the empty string to {@code null}. Will not throw an exception if the field isn't found.
@param jsonObject the input object @param fieldName the optional field name @return the value stored in the field, or {@code null} if the field isn't present
Implementation
String ?optString(Map<String, dynamic> json, String? fieldName) {
return nullIfNullOrEmpty(json[fieldName] ?? "");
}