fromJsonStringOrNull static method
Constructs a new instance of ReferencedModel,
from jsonString
, which must be a valid JSON String. Returns null
if
jsonString
is null
or if the conversion fails.
Implementation
static ReferencedModel? fromJsonStringOrNull(
String? jsonString,
) {
try {
if (jsonString!.isNotEmpty) {
final decoded = letMapOrNull<String, dynamic>(jsonDecode(jsonString));
return ReferencedModel.fromJson(decoded);
} else {
return ReferencedModel.assertRequired();
}
} catch (_) {
return null;
}
}