getMoleculeDataUrl static method

Future<String> getMoleculeDataUrl(
  1. String smiles, {
  2. int width = defaultWidth,
  3. int height = defaultHeight,
})

Returns the molecule structure as a data URL

This can be used in HTML img tags directly without additional HTTP requests

Implementation

static Future<String> getMoleculeDataUrl(String smiles, {int width = defaultWidth, int height = defaultHeight}) async {
  final imageData = await fetchMoleculeImage(smiles, width: width, height: height);
  final base64Image = base64Encode(imageData);
  return 'data:image/png;base64,$base64Image';
}