autoFromJson<T1> static method

T1? autoFromJson<T1>(
  1. dynamic json,
  2. T1 fromJson(
    1. Map<String, dynamic>
    ),
  3. T1 fromJsonStr(
    1. String
    )
)

Implementation

static T1? autoFromJson<T1>(
  dynamic json,
  T1 Function(Map<String, dynamic>) fromJson,
  T1 Function(String) fromJsonStr,
) {
  if (json is String && json.isNotEmpty) {
    return fromJsonStr(json);
  } else if (json is Map<String, dynamic>) {
    return fromJson(json);
  }
  return null;
}