Appearance
Uint16Pointer
Extension on Pointer specialized for the type argument Uint16.
Properties
value extension read / write
int get valueThe 16-bit unsigned integer at address.
A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.
The address must be 2-byte aligned.
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
external int get value;
external void set value(int value);Methods
asTypedList() extension
Uint16List asTypedList(
int length, {
Pointer<NativeFinalizerFunction<Void Function(Pointer<Void> token)>>? finalizer,
Pointer<Void>? token,
})Creates a typed list view backed by memory in the address space.
The returned view will allow access to the memory range from address to address + sizeOf<Uint16>() * length.
The user has to ensure the memory range is accessible while using the returned list.
If provided, finalizer will be run on the pointer once the typed list is GCed. If provided, token will be passed to finalizer, otherwise the this pointer itself will be passed.
The address must be 2-byte aligned.
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
external Uint16List asTypedList(
int length, {
@Since('3.1') Pointer<NativeFinalizerFunction>? finalizer,
@Since('3.1') Pointer<Void>? token,
});deprecated elementAt() extension
DEPRECATED
Use operator + instead
Pointer arithmetic (takes element size into account).
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
@Deprecated('Use operator + instead')
Pointer<Uint16> elementAt(int index) =>
Pointer.fromAddress(address + sizeOf<Uint16>() * index);Operators
operator +() extension
A pointer to the offsetth Uint16 after this one.
Returns a pointer to the Uint16 whose address is offset times the size of Uint16 after the address of this pointer. That is (this + offset).address == this.address + offset * sizeOf<Uint16>().
Also (this + offset).value is equivalent to this[offset], and similarly for setting.
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint16> operator +(int offset) =>
Pointer.fromAddress(address + sizeOf<Uint16>() * offset);operator -() extension
A pointer to the offsetth Uint16 before this one.
Equivalent to this + (-offset).
Returns a pointer to the Uint16 whose address is offset times the size of Uint16 before the address of this pointer. That is, (this - offset).address == this.address - offset * sizeOf<Uint16>().
Also, (this - offset).value is equivalent to this[-offset], and similarly for setting,
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
@Since('3.3')
@pragma("vm:prefer-inline")
Pointer<Uint16> operator -(int offset) =>
Pointer.fromAddress(address - sizeOf<Uint16>() * offset);operator extension
The 16-bit unsigned integer at address + sizeOf<Uint16>() * index.
A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.
The address must be 2-byte aligned.
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
external int operator [](int index);operator []=() extension
The 16-bit unsigned integer at address + sizeOf<Uint16>() * index.
A Dart integer is truncated to 16 bits (as if by .toUnsigned(16)) before being stored, and the 16-bit value is zero-extended when it is loaded.
The address must be 2-byte aligned.
Available on Pointer<T extends NativeType>, provided by the Uint16Pointer extension
Implementation
dart
external void operator []=(int index, int value);