saveMoleculeImage static method

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

Saves a molecule visualization as a PNG file

Returns the path to the saved file

Implementation

static Future<String> saveMoleculeImage(String smiles, String filePath, {int width = defaultWidth, int height = defaultHeight}) async {
  final imageData = await fetchMoleculeImage(smiles, width: width, height: height);

  final file = File(filePath);
  await file.writeAsBytes(imageData);

  return filePath;
}