deleteAsync method

Future<void> deleteAsync(
  1. StorageDeleteOption option
)

Implementation

Future<void> deleteAsync(StorageDeleteOption option) {
  final retValuePtr = calloc<COMObject>();
  final completer = Completer<void>();

  final hr = ptr.ref.vtable
          .elementAt(9)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(
                          Pointer, Int32 option, Pointer<COMObject>)>>>()
          .value
          .asFunction<
              int Function(Pointer, int option, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, option.value, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }

  final asyncAction = IAsyncAction.fromRawPointer(retValuePtr);
  completeAsyncAction(asyncAction, completer);

  return completer.future;
}