copy method

Block? copy()

Copy a new Block by calling Block_copy function.

Copying a block created by Dart function is invalid, because it's used for callback from native to Dart.

Implementation

Block? copy() {
  if (pointer == nullptr || function != null) {
    return null;
  }
  Pointer<Void> newPtr = Block_copy(pointer);
  if (newPtr == pointer) {
    return this;
  }
  Block result = Block.fromPointer(newPtr, function: function);
  result.types = types;
  return result;
}