loadFile static method

Icon? loadFile(
  1. String filePath
)

Load an image from file. If filePath was previously resolved from an SVG source via resolveSvgImagePath, the rasterized PNG bytes are taken directly from memory instead of reading a file from disk.

Implementation

static Icon? loadFile(String filePath) {
  final svgPngBytes = svgPngBytesFor(filePath);
  if (svgPngBytes != null) {
    return Icon._loadBytes(svgPngBytes);
  }

  return Icon._loadBytes(File(filePath).readAsBytesSync());
}