SafetySetting.fromJson constructor

SafetySetting.fromJson(
  1. Object? j
)

Implementation

factory SafetySetting.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SafetySetting(
    category: switch (json['category']) {
      null => HarmCategory.$default,
      Object $1 => HarmCategory.fromJson($1),
    },
    threshold: switch (json['threshold']) {
      null => SafetySetting_HarmBlockThreshold.$default,
      Object $1 => SafetySetting_HarmBlockThreshold.fromJson($1),
    },
  );
}