[DartError] RangeError: Invalid value: Only valid value is 0: 1; #0 Array._checkIndex (dart:ffi-patch/ffi_patch.dart:349:7)#1 main (package:swiftsoft/main.dart)<asynchronous suspension>
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
After updating flutter i started having errors everywhere where i use FFI Array in Structs when i try to access index greater then 0, why?
```dart
/// The TOKEN_PRIVILEGES structure contains information about a set
/// of privileges for an access token.
/// The LUID_AND_ATTRIBUTES structure represents a locally unique identifier
/// (LUID) and its attributes.
sealed class LuidAndAttributes extends Struct {
external LUID luid;
@Uint32()
external int attributes;
}
base class LUID extends Struct {
@Uint32()
external int LowPart;
@Int32()
external int HighPart;
}
sealed class TokenPriviliges extends Struct {
@Uint32()
external int privilegeCount;
@Array(1)
external Array privileges;
}
final Pointer token = malloc();
token.ref.privileges[0].luid.HighPart = 1;
token.ref.privileges[0].luid.LowPart = 2;
token.ref.privileges[1].luid.HighPart = 1;
token.ref.privileges[1].luid.LowPart = 2;
print([token.ref.privileges[0].luid.HighPart, token.ref.privileges[1].luid.HighPart]);
```
```
[DartError] RangeError: Invalid value: Only valid value is 0: 1; #0 Array._checkIndex (dart:ffi-patch/ffi_patch.dart:349:7)#1 main (package:swiftsoft/main.dart)
```
Contributor guide
Assessment
This issue has not been assessed yet.