ensurePhysicalSizeReady method

Future<void> ensurePhysicalSizeReady()

Implementation

Future<void> ensurePhysicalSizeReady() {
  if (ui.window.physicalSize.width > 0 && ui.window.physicalSize.height > 0) {
    return Future.value();
  }
  var ob = ScreenObserver(onScreenReady: () {
    ensureSizeCompleter.complete();
  });
  WidgetsBinding.instance.addObserver(ob);
  return ensureSizeCompleter.future.then((value) => WidgetsBinding.instance.removeObserver(ob));
}