moveAndReplaceAsync method
Implementation
Future<void> moveAndReplaceAsync(IStorageFile fileToReplace) {
final retValuePtr = calloc<COMObject>();
final completer = Completer<void>();
final hr =
ptr.ref.vtable
.elementAt(17)
.cast<
Pointer<
NativeFunction<
HRESULT Function(
Pointer,
Pointer<COMObject> fileToReplace,
Pointer<COMObject>)>>>()
.value
.asFunction<
int Function(Pointer, Pointer<COMObject> fileToReplace,
Pointer<COMObject>)>()(ptr.ref.lpVtbl,
fileToReplace.ptr.cast<Pointer<COMObject>>().value, retValuePtr);
if (FAILED(hr)) {
free(retValuePtr);
throw WindowsException(hr);
}
final asyncAction = IAsyncAction.fromRawPointer(retValuePtr);
completeAsyncAction(asyncAction, completer);
return completer.future;
}