Expose array data as pointer
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
Consider the aiString structure in [Assimp](https://github.com/assimp/assimp/blob/master/include/assimp/types.h#L384):
```
struct aiString {
uint32_t length;
char data[1024];
};
```
While the ArrayHelper, that is generated for the data, does offer [] and []= operators for accessing and manipulating the data at each index one by one, it seems like it would be more useful to expose the array data as a pointer:
```
class aiString extends Struct {
@Uint32()
int length;
Pointer get data => Pointer.fromAddress(addressOf.address + sizeOf());
}
```
[Int8Pointer](https://api.dart.dev/stable/2.9.1/dart-ffi/Int8Pointer.html) would not only offer the same operators, but would also let you have the data as a typed list view too. This struct here is extremely simple, though. Things might get hairy if there are holes/padding involved.
Contributor guide
Assessment
This issue has not been assessed yet.