awaitSync method

T awaitSync({
  1. void whileWaiting()?,
})

Implementation

T awaitSync({void Function()? whileWaiting}) {
  whileWaiting ??= () {};

  var done = true;
  T? value;

  then((_value) {
    done = true;
    value = _value;
  });

  while (!done) {}

  return value!;
}