getProvisionalVersionForDimension static method
Deduces version information purely from QR Code dimensions.
@param dimension dimension in modules @return Version for a QR Code of that dimension @throws FormatException if dimension is not 1 mod 4
Implementation
static Version getProvisionalVersionForDimension(int dimension) {
if (dimension % 4 != 1) {
throw FormatsException.instance;
}
try {
return getVersionForNumber((dimension - 17) ~/ 4);
} on ArgumentError catch (_) {
//IllegalArgumentException
throw FormatsException.instance;
}
}