CustomServiceParams.deserialize constructor

CustomServiceParams.deserialize({
  1. List<int>? bytes,
  2. CborObject<Object?>? obj,
})

Implementation

factory CustomServiceParams.deserialize({List<int>? bytes, CborObject? obj}) {
  final values = CborTagSerializable.decodeTaggedValue(
    identifier: BlockchainUtilsSerializationIdentifier.customServiceParams,
    cborBytes: bytes,
    cborObject: obj,
  );
  final body = values.rawValueAt<List<int>?>(2);
  return CustomServiceParams(
    headers: values
        .mapAt<CborStringValue, CborStringValue>(0)
        .map((k, v) => MapEntry(k.value, v.value)),
    requestMethod: RequestMethod.fromValue(values.rawValueAt(1)),
    body: body == null ? null : BuBytes.immutable(body),
    path: Uri.parse(values.rawValueAt<String>(3)),
    responseEncoding: ServiceReponseEncoding.fromValue(values.rawValueAt(4)),
  );
}