WriteFeatureValuesPayload.fromJson constructor

WriteFeatureValuesPayload.fromJson(
  1. Object? j
)

Implementation

factory WriteFeatureValuesPayload.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return WriteFeatureValuesPayload(
    entityId: switch (json['entityId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    featureValues: switch (json['featureValues']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): FeatureValue.fromJson(e.value),
      },
      _ => throw const FormatException('"featureValues" is not an object'),
    },
  );
}