getWorldFile static method

String? getWorldFile(
  1. String imagePath
)

Implementation

static String? getWorldFile(String imagePath) {
  String folder = p.dirname(imagePath);
  var name = p.basenameWithoutExtension(imagePath);
  var ext;
  var lastDot = imagePath.lastIndexOf(".");
  if (lastDot > 0) {
    ext = imagePath.substring(lastDot + 1);
  } else {}
  var wldExt;
  if (ext == JPG_EXT) {
    wldExt = JPG_WLD_EXT;
  } else if (ext == PNG_EXT) {
    wldExt = PNG_WLD_EXT;
  } else if (ext == TIF_EXT || ext == TIFF_EXT) {
    wldExt = TIF_WLD_EXT;
  } else {
    return null;
  }

  var wldPath = p.join(folder, name + "." + wldExt);
  var wldFile = File(wldPath);
  if (wldFile.existsSync()) {
    return wldPath;
  }
  return null;
}