allocate<T extends NativeType> static method

Pointer<T> allocate<T extends NativeType>(
  1. int bytes
)

Implementation

static Pointer<T> allocate<T extends NativeType>(int bytes) {
  final p = _alloc(bytes);
  if (p == nullptr) {
    throw StateError('native allocation of $bytes bytes failed');
  }
  return p.cast<T>();
}