asList method

Int16List asList([
  1. int? length
])

Returns a dart list view on the pointer.

The resulting list operates on the same memory. This means if you modify elements of the list, the data the pointer points to changes as well. You can either get a reference to the whole pointer, or only the first length elements. (Counted in elements, not bytes).

Note: As the returned list is a reference, calling SodiumPointer.dispose is not allowed as long as you still use the returned list. If you still dispose of the pointer, any try to access the data will crash your application.

Implementation

Int16List asList([int? length]) => ptr.asTypedList(length ?? count);