Pointer<T extends NativeType>.fromAddress constructor
Pointer<T extends NativeType>.fromAddress (
- int ptr, [
- Memory? bindTo
Constructs a pointer from an address.
The optional parameter bindTo can be ommited, if and only if
Memory.global is set, which is then used as Memory to bind to.
Implementation
factory Pointer.fromAddress(int ptr, [Memory? bindTo]) {
final Memory? memory = bindTo ?? Memory.global;
if (memory == null) {
throw StateError(
'No global memory set and no explcity memory to bind to given!');
}
return Pointer._(ptr, memory, _isUnsizedType<T>() ? null : sizeOf<T>());
}