I'm trying to create images from a Feature Service to put in the legend of a web mapping application.
Since there are no 'legend' endpoints for those I need to render these images from the layer's 'drawing info'.
I cannot use the Legend widget since it is a custom application.
In JS 3.x one can use dojo/gfx to create a symbol based on the drawing info, but I don't know what's available in 4.x?
Any advice is appreciated.
You can use symbolUtils to help you out here.
https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-support-symbolUtils.html
const symbol = await getDisplayedSymbol(graphic);
const previewElement = await renderPreviewHTML(symbol, options);