getSize method
Implementation
@override
Future<Size?> getSize() async {
/// clientWidth and clientHeight are in pixels,
/// so we have to test for a larger size to minimize rounding errors.
const multiplicator = 50;
final fResolution = getResolution();
var element = window.document.getElementById("millimetersPluginProbe");
if (element == null) {
element = DivElement()
..id = "millimetersPluginProbe"
..style.position = "absolute"
..style.top = "0"
..style.left = "0"
..style.width = "${multiplicator}mm"
..style.height = "${multiplicator}mm"
..style.visibility = "hidden";
window.document.getElementsByTagName("body").first.append(element);
}
final ratio = Size(element.clientWidth / multiplicator,
element.clientHeight / multiplicator);
final resolution = (await fResolution)!;
return Size(
resolution.width / ratio.width, resolution.height / ratio.height);
}