callWithGuardedStateAsync<R>  method 
Executes call preserving the internal drawing state, accepting Future
as return value.
See saveState and restoreState.
Implementation
FutureOr<R> callWithGuardedStateAsync<R>(FutureOr<R> Function() call) {
  saveState();
  var restored = false;
  try {
    var ret = call();
    if (ret is Future<R>) {
      return ret.whenComplete(() {
        restored = true;
        restoreState();
      });
    } else {
      restored = true;
      restoreState();
      return ret;
    }
  } finally {
    if (!restored) {
      restoreState();
    }
  }
}