You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made a TypeScript script to create a bin file, and successfully read it back. No issues there. I then ran flatc to create Dart code, tried to read the binary with this code:
class MasterDeck {
static oj.MasterDeckList? mdl;
static Future<void> load() async {
// makes no difference between reading file and asset
final ByteData data = await rootBundle.load('assets/master_decks.bin');
// var file = File('./assets/master_decks.bin');
// var data = file.readAsBytesSync();
debugPrint("data: ${data.lengthInBytes}");
final List<int> bytes = data.buffer.asInt64List();
mdl = oj.MasterDeckList(bytes);
debugPrint("count: ${mdl!.count}");
debugPrint("list: ${mdl!.list}");
}
}
There are 18 decks in the list, so count should be 18, and list, obviously, should not be null. Something isn't lining up right. Perhaps the way the ByteData is being converted to List? But that's just a no-op, right, changing the point of view on the same chunk of bytes?
The text was updated successfully, but these errors were encountered:
flatc 24.3.25, running on Linux. Here's the schema:
I made a TypeScript script to create a bin file, and successfully read it back. No issues there. I then ran flatc to create Dart code, tried to read the binary with this code:
This results in the output:
There are 18 decks in the list, so count should be 18, and list, obviously, should not be null. Something isn't lining up right. Perhaps the way the ByteData is being converted to List? But that's just a no-op, right, changing the point of view on the same chunk of bytes?
The text was updated successfully, but these errors were encountered: