SchedulingNodeAffinity.fromJson constructor

SchedulingNodeAffinity.fromJson(
  1. Object? j
)

Implementation

factory SchedulingNodeAffinity.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SchedulingNodeAffinity(
    key: switch (json['key']) {
      null => null,
      Object $1 => decodeString($1),
    },
    operator: switch (json['operator']) {
      null => null,
      Object $1 => decodeString($1),
    },
    values: switch (json['values']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"values" is not a list'),
    },
  );
}