fromJsonStringOrNull static method

Model? fromJsonStringOrNull(
  1. String? source
)

Implementation

static Model? fromJsonStringOrNull(
  String? source,
) {
  try {
    if (source!.isNotEmpty) {
      final decoded = letMapOrNull<String, dynamic>(jsonDecode(source));
      return Model.fromJson(decoded);
    } else {
      return const Model();
    }
  } catch (_) {
    return null;
  }
}