ConfigChange.fromJson constructor

ConfigChange.fromJson(
  1. Object? j
)

Implementation

factory ConfigChange.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ConfigChange(
    element: switch (json['element']) {
      null => '',
      Object $1 => decodeString($1),
    },
    oldValue: switch (json['oldValue']) {
      null => '',
      Object $1 => decodeString($1),
    },
    newValue: switch (json['newValue']) {
      null => '',
      Object $1 => decodeString($1),
    },
    changeType: switch (json['changeType']) {
      null => ChangeType.$default,
      Object $1 => ChangeType.fromJson($1),
    },
    advices: switch (json['advices']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Advice.fromJson(i)],
      _ => throw const FormatException('"advices" is not a list'),
    },
  );
}