sizeOf<T extends NativeType> function

int sizeOf<T extends NativeType>()

Number of bytes used by native type T.

MUST NOT be called with types annoteted with @unsized or before Memory.init() was called or else an exception will be thrown.

Implementation

int sizeOf<T extends NativeType>() {
  int? size;
  if (isPointerType<T>()) {
    size = sizeMap[IntPtr];
  } else {
    size = sizeMap[T];
  }
  if (size != null) {
    return size;
  } else {
    throw new ArgumentError('The type $T is not known!');
  }
}