ImageX constructor

ImageX(
  1. String path, {
  2. bool lazy = true,
})

Implementation

ImageX(super.path, {super.lazy = true}) {
  // if not jpg, jpeg, png, webp, gif, bmp
  if (!path.endsWith('.jpg') &&
      !path.endsWith('.jpeg') &&
      !path.endsWith('.png') &&
      !path.endsWith('.webp') &&
      !path.endsWith('.gif') &&
      !path.endsWith('.bmp')) {
    throw Exception(
      'ImageX only supports jpg, jpeg, png, webp, gif, and bmp files.',
    );
  }

  if (!lazy) {
    Future.microtask(() => asset);
  }
}