blob: 174fe1d8dd9982674f62f0bffe6bb8fd621d5b3b [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001// automatically generated by the FlatBuffers compiler, do not modify
James Kuszmaul8e62b022022-03-22 09:33:25 -07002// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable
Austin Schuhe89fa2d2019-08-14 20:24:23 -07003
4library my_game.example;
5
6import 'dart:typed_data' show Uint8List;
7import 'package:flat_buffers/flat_buffers.dart' as fb;
8
9import './monster_test_my_game_generated.dart' as my_game;
10import './monster_test_my_game.example2_generated.dart' as my_game_example2;
11
12/// Composite components of Monster color.
13class Color {
14 final int value;
15 const Color._(this.value);
16
17 factory Color.fromValue(int value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -070018 final result = values[value];
19 if (result == null) {
20 if (value == 0) {
21 return Color._(0);
22 } else {
23 throw StateError('Invalid value $value for bit flag enum Color');
24 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -070025 }
James Kuszmaul8e62b022022-03-22 09:33:25 -070026 return result;
Austin Schuhe89fa2d2019-08-14 20:24:23 -070027 }
28
James Kuszmaul8e62b022022-03-22 09:33:25 -070029 static Color? _createOrNull(int? value) =>
30 value == null ? null : Color.fromValue(value);
31
Austin Schuhe89fa2d2019-08-14 20:24:23 -070032 static bool containsValue(int value) => values.containsKey(value);
33
James Kuszmaul8e62b022022-03-22 09:33:25 -070034 static const Color Red = Color._(1);
Austin Schuhe89fa2d2019-08-14 20:24:23 -070035
36 /// \brief color Green
37 /// Green is bit_flag with value (1u << 1)
James Kuszmaul8e62b022022-03-22 09:33:25 -070038 static const Color Green = Color._(2);
Austin Schuhe89fa2d2019-08-14 20:24:23 -070039
40 /// \brief color Blue (1u << 3)
James Kuszmaul8e62b022022-03-22 09:33:25 -070041 static const Color Blue = Color._(8);
42 static const Map<int, Color> values = {
43 1: Red,
44 2: Green,
45 8: Blue};
Austin Schuhe89fa2d2019-08-14 20:24:23 -070046
James Kuszmaul8e62b022022-03-22 09:33:25 -070047 static const fb.Reader<Color> reader = _ColorReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -070048
49 @override
50 String toString() {
51 return 'Color{value: $value}';
52 }
53}
54
55class _ColorReader extends fb.Reader<Color> {
56 const _ColorReader();
57
58 @override
59 int get size => 1;
60
61 @override
62 Color read(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -070063 Color.fromValue(const fb.Uint8Reader().read(bc, offset));
Austin Schuhe89fa2d2019-08-14 20:24:23 -070064}
65
Austin Schuh272c6132020-11-14 16:37:52 -080066class Race {
67 final int value;
68 const Race._(this.value);
69
70 factory Race.fromValue(int value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -070071 final result = values[value];
72 if (result == null) {
73 throw StateError('Invalid value $value for bit flag enum Race');
Austin Schuh272c6132020-11-14 16:37:52 -080074 }
James Kuszmaul8e62b022022-03-22 09:33:25 -070075 return result;
Austin Schuh272c6132020-11-14 16:37:52 -080076 }
77
James Kuszmaul8e62b022022-03-22 09:33:25 -070078 static Race? _createOrNull(int? value) =>
79 value == null ? null : Race.fromValue(value);
80
Austin Schuh272c6132020-11-14 16:37:52 -080081 static const int minValue = -1;
82 static const int maxValue = 2;
83 static bool containsValue(int value) => values.containsKey(value);
84
James Kuszmaul8e62b022022-03-22 09:33:25 -070085 static const Race None = Race._(-1);
86 static const Race Human = Race._(0);
87 static const Race Dwarf = Race._(1);
88 static const Race Elf = Race._(2);
89 static const Map<int, Race> values = {
90 -1: None,
91 0: Human,
92 1: Dwarf,
93 2: Elf};
Austin Schuh272c6132020-11-14 16:37:52 -080094
James Kuszmaul8e62b022022-03-22 09:33:25 -070095 static const fb.Reader<Race> reader = _RaceReader();
Austin Schuh272c6132020-11-14 16:37:52 -080096
97 @override
98 String toString() {
99 return 'Race{value: $value}';
100 }
101}
102
103class _RaceReader extends fb.Reader<Race> {
104 const _RaceReader();
105
106 @override
107 int get size => 1;
108
109 @override
110 Race read(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700111 Race.fromValue(const fb.Int8Reader().read(bc, offset));
112}
113
114class LongEnum {
115 final int value;
116 const LongEnum._(this.value);
117
118 factory LongEnum.fromValue(int value) {
119 final result = values[value];
120 if (result == null) {
121 if (value == 0) {
122 return LongEnum._(0);
123 } else {
124 throw StateError('Invalid value $value for bit flag enum LongEnum');
125 }
126 }
127 return result;
128 }
129
130 static LongEnum? _createOrNull(int? value) =>
131 value == null ? null : LongEnum.fromValue(value);
132
133 static bool containsValue(int value) => values.containsKey(value);
134
135 static const LongEnum LongOne = LongEnum._(2);
136 static const LongEnum LongTwo = LongEnum._(4);
137 static const LongEnum LongBig = LongEnum._(1099511627776);
138 static const Map<int, LongEnum> values = {
139 2: LongOne,
140 4: LongTwo,
141 1099511627776: LongBig};
142
143 static const fb.Reader<LongEnum> reader = _LongEnumReader();
144
145 @override
146 String toString() {
147 return 'LongEnum{value: $value}';
148 }
149}
150
151class _LongEnumReader extends fb.Reader<LongEnum> {
152 const _LongEnumReader();
153
154 @override
Austin Schuh2dd86a92022-09-14 21:19:23 -0700155 int get size => 8;
James Kuszmaul8e62b022022-03-22 09:33:25 -0700156
157 @override
158 LongEnum read(fb.BufferContext bc, int offset) =>
159 LongEnum.fromValue(const fb.Uint64Reader().read(bc, offset));
Austin Schuh272c6132020-11-14 16:37:52 -0800160}
161
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700162class AnyTypeId {
163 final int value;
164 const AnyTypeId._(this.value);
165
166 factory AnyTypeId.fromValue(int value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700167 final result = values[value];
168 if (result == null) {
169 throw StateError('Invalid value $value for bit flag enum AnyTypeId');
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700170 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700171 return result;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700172 }
173
James Kuszmaul8e62b022022-03-22 09:33:25 -0700174 static AnyTypeId? _createOrNull(int? value) =>
175 value == null ? null : AnyTypeId.fromValue(value);
176
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700177 static const int minValue = 0;
178 static const int maxValue = 3;
179 static bool containsValue(int value) => values.containsKey(value);
180
James Kuszmaul8e62b022022-03-22 09:33:25 -0700181 static const AnyTypeId NONE = AnyTypeId._(0);
182 static const AnyTypeId Monster = AnyTypeId._(1);
183 static const AnyTypeId TestSimpleTableWithEnum = AnyTypeId._(2);
184 static const AnyTypeId MyGame_Example2_Monster = AnyTypeId._(3);
185 static const Map<int, AnyTypeId> values = {
186 0: NONE,
187 1: Monster,
188 2: TestSimpleTableWithEnum,
189 3: MyGame_Example2_Monster};
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700190
James Kuszmaul8e62b022022-03-22 09:33:25 -0700191 static const fb.Reader<AnyTypeId> reader = _AnyTypeIdReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700192
193 @override
194 String toString() {
195 return 'AnyTypeId{value: $value}';
196 }
197}
198
199class _AnyTypeIdReader extends fb.Reader<AnyTypeId> {
200 const _AnyTypeIdReader();
201
202 @override
203 int get size => 1;
204
205 @override
206 AnyTypeId read(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700207 AnyTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700208}
209
210class AnyUniqueAliasesTypeId {
211 final int value;
212 const AnyUniqueAliasesTypeId._(this.value);
213
214 factory AnyUniqueAliasesTypeId.fromValue(int value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700215 final result = values[value];
216 if (result == null) {
217 throw StateError('Invalid value $value for bit flag enum AnyUniqueAliasesTypeId');
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700218 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700219 return result;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700220 }
221
James Kuszmaul8e62b022022-03-22 09:33:25 -0700222 static AnyUniqueAliasesTypeId? _createOrNull(int? value) =>
223 value == null ? null : AnyUniqueAliasesTypeId.fromValue(value);
224
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700225 static const int minValue = 0;
226 static const int maxValue = 3;
227 static bool containsValue(int value) => values.containsKey(value);
228
James Kuszmaul8e62b022022-03-22 09:33:25 -0700229 static const AnyUniqueAliasesTypeId NONE = AnyUniqueAliasesTypeId._(0);
230 static const AnyUniqueAliasesTypeId M = AnyUniqueAliasesTypeId._(1);
231 static const AnyUniqueAliasesTypeId TS = AnyUniqueAliasesTypeId._(2);
232 static const AnyUniqueAliasesTypeId M2 = AnyUniqueAliasesTypeId._(3);
233 static const Map<int, AnyUniqueAliasesTypeId> values = {
234 0: NONE,
235 1: M,
236 2: TS,
237 3: M2};
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700238
James Kuszmaul8e62b022022-03-22 09:33:25 -0700239 static const fb.Reader<AnyUniqueAliasesTypeId> reader = _AnyUniqueAliasesTypeIdReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700240
241 @override
242 String toString() {
243 return 'AnyUniqueAliasesTypeId{value: $value}';
244 }
245}
246
247class _AnyUniqueAliasesTypeIdReader extends fb.Reader<AnyUniqueAliasesTypeId> {
248 const _AnyUniqueAliasesTypeIdReader();
249
250 @override
251 int get size => 1;
252
253 @override
254 AnyUniqueAliasesTypeId read(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700255 AnyUniqueAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700256}
257
258class AnyAmbiguousAliasesTypeId {
259 final int value;
260 const AnyAmbiguousAliasesTypeId._(this.value);
261
262 factory AnyAmbiguousAliasesTypeId.fromValue(int value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700263 final result = values[value];
264 if (result == null) {
265 throw StateError('Invalid value $value for bit flag enum AnyAmbiguousAliasesTypeId');
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700266 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700267 return result;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700268 }
269
James Kuszmaul8e62b022022-03-22 09:33:25 -0700270 static AnyAmbiguousAliasesTypeId? _createOrNull(int? value) =>
271 value == null ? null : AnyAmbiguousAliasesTypeId.fromValue(value);
272
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700273 static const int minValue = 0;
274 static const int maxValue = 3;
275 static bool containsValue(int value) => values.containsKey(value);
276
James Kuszmaul8e62b022022-03-22 09:33:25 -0700277 static const AnyAmbiguousAliasesTypeId NONE = AnyAmbiguousAliasesTypeId._(0);
278 static const AnyAmbiguousAliasesTypeId M1 = AnyAmbiguousAliasesTypeId._(1);
279 static const AnyAmbiguousAliasesTypeId M2 = AnyAmbiguousAliasesTypeId._(2);
280 static const AnyAmbiguousAliasesTypeId M3 = AnyAmbiguousAliasesTypeId._(3);
281 static const Map<int, AnyAmbiguousAliasesTypeId> values = {
282 0: NONE,
283 1: M1,
284 2: M2,
285 3: M3};
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700286
James Kuszmaul8e62b022022-03-22 09:33:25 -0700287 static const fb.Reader<AnyAmbiguousAliasesTypeId> reader = _AnyAmbiguousAliasesTypeIdReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700288
289 @override
290 String toString() {
291 return 'AnyAmbiguousAliasesTypeId{value: $value}';
292 }
293}
294
295class _AnyAmbiguousAliasesTypeIdReader extends fb.Reader<AnyAmbiguousAliasesTypeId> {
296 const _AnyAmbiguousAliasesTypeIdReader();
297
298 @override
299 int get size => 1;
300
301 @override
302 AnyAmbiguousAliasesTypeId read(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700303 AnyAmbiguousAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset));
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700304}
305
306class Test {
307 Test._(this._bc, this._bcOffset);
308
James Kuszmaul8e62b022022-03-22 09:33:25 -0700309 static const fb.Reader<Test> reader = _TestReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700310
311 final fb.BufferContext _bc;
312 final int _bcOffset;
313
314 int get a => const fb.Int16Reader().read(_bc, _bcOffset + 0);
315 int get b => const fb.Int8Reader().read(_bc, _bcOffset + 2);
316
317 @override
318 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700319 return 'Test{a: ${a}, b: ${b}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700320 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700321
322 TestT unpack() => TestT(
323 a: a,
324 b: b);
325
326 static int pack(fb.Builder fbBuilder, TestT? object) {
327 if (object == null) return 0;
328 return object.pack(fbBuilder);
329 }
330}
331
332class TestT implements fb.Packable {
333 int a;
334 int b;
335
336 TestT({
337 required this.a,
338 required this.b});
339
340 @override
341 int pack(fb.Builder fbBuilder) {
342 fbBuilder.pad(1);
343 fbBuilder.putInt8(b);
344 fbBuilder.putInt16(a);
345 return fbBuilder.offset;
346 }
347
348 @override
349 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700350 return 'TestT{a: ${a}, b: ${b}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700351 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700352}
353
354class _TestReader extends fb.StructReader<Test> {
355 const _TestReader();
356
357 @override
358 int get size => 4;
359
360 @override
361 Test createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700362 Test._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700363}
364
365class TestBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700366 TestBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700367
368 final fb.Builder fbBuilder;
369
370 int finish(int a, int b) {
371 fbBuilder.pad(1);
372 fbBuilder.putInt8(b);
373 fbBuilder.putInt16(a);
374 return fbBuilder.offset;
375 }
376
377}
378
379class TestObjectBuilder extends fb.ObjectBuilder {
380 final int _a;
381 final int _b;
382
383 TestObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -0700384 required int a,
385 required int b,
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700386 })
387 : _a = a,
388 _b = b;
389
390 /// Finish building, and store into the [fbBuilder].
391 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700392 int finish(fb.Builder fbBuilder) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700393 fbBuilder.pad(1);
394 fbBuilder.putInt8(_b);
395 fbBuilder.putInt16(_a);
396 return fbBuilder.offset;
397 }
398
399 /// Convenience method to serialize to byte list.
400 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700401 Uint8List toBytes([String? fileIdentifier]) {
402 final fbBuilder = fb.Builder(deduplicateTables: false);
403 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
404 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700405 }
406}
407class TestSimpleTableWithEnum {
408 TestSimpleTableWithEnum._(this._bc, this._bcOffset);
409 factory TestSimpleTableWithEnum(List<int> bytes) {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700410 final rootRef = fb.BufferContext.fromBytes(bytes);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700411 return reader.read(rootRef, 0);
412 }
413
James Kuszmaul8e62b022022-03-22 09:33:25 -0700414 static const fb.Reader<TestSimpleTableWithEnum> reader = _TestSimpleTableWithEnumReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700415
416 final fb.BufferContext _bc;
417 final int _bcOffset;
418
James Kuszmaul8e62b022022-03-22 09:33:25 -0700419 Color get color => Color.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 4, 2));
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700420
421 @override
422 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700423 return 'TestSimpleTableWithEnum{color: ${color}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700424 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700425
426 TestSimpleTableWithEnumT unpack() => TestSimpleTableWithEnumT(
427 color: color);
428
429 static int pack(fb.Builder fbBuilder, TestSimpleTableWithEnumT? object) {
430 if (object == null) return 0;
431 return object.pack(fbBuilder);
432 }
433}
434
435class TestSimpleTableWithEnumT implements fb.Packable {
436 Color color;
437
438 TestSimpleTableWithEnumT({
439 this.color = Color.Green});
440
441 @override
442 int pack(fb.Builder fbBuilder) {
443 fbBuilder.startTable(1);
444 fbBuilder.addUint8(0, color.value);
445 return fbBuilder.endTable();
446 }
447
448 @override
449 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700450 return 'TestSimpleTableWithEnumT{color: ${color}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700451 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700452}
453
454class _TestSimpleTableWithEnumReader extends fb.TableReader<TestSimpleTableWithEnum> {
455 const _TestSimpleTableWithEnumReader();
456
457 @override
458 TestSimpleTableWithEnum createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700459 TestSimpleTableWithEnum._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700460}
461
462class TestSimpleTableWithEnumBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700463 TestSimpleTableWithEnumBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700464
465 final fb.Builder fbBuilder;
466
467 void begin() {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700468 fbBuilder.startTable(1);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700469 }
470
James Kuszmaul8e62b022022-03-22 09:33:25 -0700471 int addColor(Color? color) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700472 fbBuilder.addUint8(0, color?.value);
473 return fbBuilder.offset;
474 }
475
476 int finish() {
477 return fbBuilder.endTable();
478 }
479}
480
481class TestSimpleTableWithEnumObjectBuilder extends fb.ObjectBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700482 final Color? _color;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700483
484 TestSimpleTableWithEnumObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -0700485 Color? color,
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700486 })
487 : _color = color;
488
489 /// Finish building, and store into the [fbBuilder].
490 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700491 int finish(fb.Builder fbBuilder) {
492 fbBuilder.startTable(1);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700493 fbBuilder.addUint8(0, _color?.value);
494 return fbBuilder.endTable();
495 }
496
497 /// Convenience method to serialize to byte list.
498 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700499 Uint8List toBytes([String? fileIdentifier]) {
500 final fbBuilder = fb.Builder(deduplicateTables: false);
501 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
502 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700503 }
504}
505class Vec3 {
506 Vec3._(this._bc, this._bcOffset);
507
James Kuszmaul8e62b022022-03-22 09:33:25 -0700508 static const fb.Reader<Vec3> reader = _Vec3Reader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700509
510 final fb.BufferContext _bc;
511 final int _bcOffset;
512
513 double get x => const fb.Float32Reader().read(_bc, _bcOffset + 0);
514 double get y => const fb.Float32Reader().read(_bc, _bcOffset + 4);
515 double get z => const fb.Float32Reader().read(_bc, _bcOffset + 8);
516 double get test1 => const fb.Float64Reader().read(_bc, _bcOffset + 16);
James Kuszmaul8e62b022022-03-22 09:33:25 -0700517 Color get test2 => Color.fromValue(const fb.Uint8Reader().read(_bc, _bcOffset + 24));
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700518 Test get test3 => Test.reader.read(_bc, _bcOffset + 26);
519
520 @override
521 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700522 return 'Vec3{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700523 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700524
525 Vec3T unpack() => Vec3T(
526 x: x,
527 y: y,
528 z: z,
529 test1: test1,
530 test2: test2,
531 test3: test3.unpack());
532
533 static int pack(fb.Builder fbBuilder, Vec3T? object) {
534 if (object == null) return 0;
535 return object.pack(fbBuilder);
536 }
537}
538
539class Vec3T implements fb.Packable {
540 double x;
541 double y;
542 double z;
543 double test1;
544 Color test2;
545 TestT test3;
546
547 Vec3T({
548 required this.x,
549 required this.y,
550 required this.z,
551 required this.test1,
552 required this.test2,
553 required this.test3});
554
555 @override
556 int pack(fb.Builder fbBuilder) {
557 fbBuilder.pad(2);
558 test3.pack(fbBuilder);
559 fbBuilder.pad(1);
560 fbBuilder.putUint8(test2.value);
561 fbBuilder.putFloat64(test1);
562 fbBuilder.pad(4);
563 fbBuilder.putFloat32(z);
564 fbBuilder.putFloat32(y);
565 fbBuilder.putFloat32(x);
566 return fbBuilder.offset;
567 }
568
569 @override
570 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700571 return 'Vec3T{x: ${x}, y: ${y}, z: ${z}, test1: ${test1}, test2: ${test2}, test3: ${test3}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700572 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700573}
574
575class _Vec3Reader extends fb.StructReader<Vec3> {
576 const _Vec3Reader();
577
578 @override
579 int get size => 32;
580
581 @override
582 Vec3 createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700583 Vec3._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700584}
585
586class Vec3Builder {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700587 Vec3Builder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700588
589 final fb.Builder fbBuilder;
590
591 int finish(double x, double y, double z, double test1, Color test2, fb.StructBuilder test3) {
592 fbBuilder.pad(2);
593 test3();
594 fbBuilder.pad(1);
James Kuszmaul8e62b022022-03-22 09:33:25 -0700595 fbBuilder.putUint8(test2.value);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700596 fbBuilder.putFloat64(test1);
597 fbBuilder.pad(4);
598 fbBuilder.putFloat32(z);
599 fbBuilder.putFloat32(y);
600 fbBuilder.putFloat32(x);
601 return fbBuilder.offset;
602 }
603
604}
605
606class Vec3ObjectBuilder extends fb.ObjectBuilder {
607 final double _x;
608 final double _y;
609 final double _z;
610 final double _test1;
611 final Color _test2;
612 final TestObjectBuilder _test3;
613
614 Vec3ObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -0700615 required double x,
616 required double y,
617 required double z,
618 required double test1,
619 required Color test2,
620 required TestObjectBuilder test3,
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700621 })
622 : _x = x,
623 _y = y,
624 _z = z,
625 _test1 = test1,
626 _test2 = test2,
627 _test3 = test3;
628
629 /// Finish building, and store into the [fbBuilder].
630 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700631 int finish(fb.Builder fbBuilder) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700632 fbBuilder.pad(2);
633 _test3.finish(fbBuilder);
634 fbBuilder.pad(1);
James Kuszmaul8e62b022022-03-22 09:33:25 -0700635 fbBuilder.putUint8(_test2.value);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700636 fbBuilder.putFloat64(_test1);
637 fbBuilder.pad(4);
638 fbBuilder.putFloat32(_z);
639 fbBuilder.putFloat32(_y);
640 fbBuilder.putFloat32(_x);
641 return fbBuilder.offset;
642 }
643
644 /// Convenience method to serialize to byte list.
645 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700646 Uint8List toBytes([String? fileIdentifier]) {
647 final fbBuilder = fb.Builder(deduplicateTables: false);
648 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
649 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700650 }
651}
652class Ability {
653 Ability._(this._bc, this._bcOffset);
654
James Kuszmaul8e62b022022-03-22 09:33:25 -0700655 static const fb.Reader<Ability> reader = _AbilityReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700656
657 final fb.BufferContext _bc;
658 final int _bcOffset;
659
660 int get id => const fb.Uint32Reader().read(_bc, _bcOffset + 0);
661 int get distance => const fb.Uint32Reader().read(_bc, _bcOffset + 4);
662
663 @override
664 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700665 return 'Ability{id: ${id}, distance: ${distance}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700666 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700667
668 AbilityT unpack() => AbilityT(
669 id: id,
670 distance: distance);
671
672 static int pack(fb.Builder fbBuilder, AbilityT? object) {
673 if (object == null) return 0;
674 return object.pack(fbBuilder);
675 }
676}
677
678class AbilityT implements fb.Packable {
679 int id;
680 int distance;
681
682 AbilityT({
683 required this.id,
684 required this.distance});
685
686 @override
687 int pack(fb.Builder fbBuilder) {
688 fbBuilder.putUint32(distance);
689 fbBuilder.putUint32(id);
690 return fbBuilder.offset;
691 }
692
693 @override
694 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700695 return 'AbilityT{id: ${id}, distance: ${distance}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700696 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700697}
698
699class _AbilityReader extends fb.StructReader<Ability> {
700 const _AbilityReader();
701
702 @override
703 int get size => 8;
704
705 @override
706 Ability createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -0700707 Ability._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700708}
709
710class AbilityBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700711 AbilityBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700712
713 final fb.Builder fbBuilder;
714
715 int finish(int id, int distance) {
716 fbBuilder.putUint32(distance);
717 fbBuilder.putUint32(id);
718 return fbBuilder.offset;
719 }
720
721}
722
723class AbilityObjectBuilder extends fb.ObjectBuilder {
724 final int _id;
725 final int _distance;
726
727 AbilityObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -0700728 required int id,
729 required int distance,
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700730 })
731 : _id = id,
732 _distance = distance;
733
734 /// Finish building, and store into the [fbBuilder].
735 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700736 int finish(fb.Builder fbBuilder) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700737 fbBuilder.putUint32(_distance);
738 fbBuilder.putUint32(_id);
739 return fbBuilder.offset;
740 }
741
742 /// Convenience method to serialize to byte list.
743 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -0700744 Uint8List toBytes([String? fileIdentifier]) {
745 final fbBuilder = fb.Builder(deduplicateTables: false);
746 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
747 return fbBuilder.buffer;
748 }
749}
750class StructOfStructs {
751 StructOfStructs._(this._bc, this._bcOffset);
752
753 static const fb.Reader<StructOfStructs> reader = _StructOfStructsReader();
754
755 final fb.BufferContext _bc;
756 final int _bcOffset;
757
758 Ability get a => Ability.reader.read(_bc, _bcOffset + 0);
759 Test get b => Test.reader.read(_bc, _bcOffset + 8);
760 Ability get c => Ability.reader.read(_bc, _bcOffset + 12);
761
762 @override
763 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700764 return 'StructOfStructs{a: ${a}, b: ${b}, c: ${c}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700765 }
766
767 StructOfStructsT unpack() => StructOfStructsT(
768 a: a.unpack(),
769 b: b.unpack(),
770 c: c.unpack());
771
772 static int pack(fb.Builder fbBuilder, StructOfStructsT? object) {
773 if (object == null) return 0;
774 return object.pack(fbBuilder);
775 }
776}
777
778class StructOfStructsT implements fb.Packable {
779 AbilityT a;
780 TestT b;
781 AbilityT c;
782
783 StructOfStructsT({
784 required this.a,
785 required this.b,
786 required this.c});
787
788 @override
789 int pack(fb.Builder fbBuilder) {
790 c.pack(fbBuilder);
791 b.pack(fbBuilder);
792 a.pack(fbBuilder);
793 return fbBuilder.offset;
794 }
795
796 @override
797 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700798 return 'StructOfStructsT{a: ${a}, b: ${b}, c: ${c}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -0700799 }
800}
801
802class _StructOfStructsReader extends fb.StructReader<StructOfStructs> {
803 const _StructOfStructsReader();
804
805 @override
806 int get size => 20;
807
808 @override
809 StructOfStructs createObject(fb.BufferContext bc, int offset) =>
810 StructOfStructs._(bc, offset);
811}
812
813class StructOfStructsBuilder {
814 StructOfStructsBuilder(this.fbBuilder);
815
816 final fb.Builder fbBuilder;
817
818 int finish(fb.StructBuilder a, fb.StructBuilder b, fb.StructBuilder c) {
819 c();
820 b();
821 a();
822 return fbBuilder.offset;
823 }
824
825}
826
827class StructOfStructsObjectBuilder extends fb.ObjectBuilder {
828 final AbilityObjectBuilder _a;
829 final TestObjectBuilder _b;
830 final AbilityObjectBuilder _c;
831
832 StructOfStructsObjectBuilder({
833 required AbilityObjectBuilder a,
834 required TestObjectBuilder b,
835 required AbilityObjectBuilder c,
836 })
837 : _a = a,
838 _b = b,
839 _c = c;
840
841 /// Finish building, and store into the [fbBuilder].
842 @override
843 int finish(fb.Builder fbBuilder) {
844 _c.finish(fbBuilder);
845 _b.finish(fbBuilder);
846 _a.finish(fbBuilder);
847 return fbBuilder.offset;
848 }
849
850 /// Convenience method to serialize to byte list.
851 @override
852 Uint8List toBytes([String? fileIdentifier]) {
853 final fbBuilder = fb.Builder(deduplicateTables: false);
854 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
855 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700856 }
857}
Austin Schuh2dd86a92022-09-14 21:19:23 -0700858class StructOfStructsOfStructs {
859 StructOfStructsOfStructs._(this._bc, this._bcOffset);
860
861 static const fb.Reader<StructOfStructsOfStructs> reader = _StructOfStructsOfStructsReader();
862
863 final fb.BufferContext _bc;
864 final int _bcOffset;
865
866 StructOfStructs get a => StructOfStructs.reader.read(_bc, _bcOffset + 0);
867
868 @override
869 String toString() {
870 return 'StructOfStructsOfStructs{a: ${a}}';
871 }
872
873 StructOfStructsOfStructsT unpack() => StructOfStructsOfStructsT(
874 a: a.unpack());
875
876 static int pack(fb.Builder fbBuilder, StructOfStructsOfStructsT? object) {
877 if (object == null) return 0;
878 return object.pack(fbBuilder);
879 }
880}
881
882class StructOfStructsOfStructsT implements fb.Packable {
883 StructOfStructsT a;
884
885 StructOfStructsOfStructsT({
886 required this.a});
887
888 @override
889 int pack(fb.Builder fbBuilder) {
890 a.pack(fbBuilder);
891 return fbBuilder.offset;
892 }
893
894 @override
895 String toString() {
896 return 'StructOfStructsOfStructsT{a: ${a}}';
897 }
898}
899
900class _StructOfStructsOfStructsReader extends fb.StructReader<StructOfStructsOfStructs> {
901 const _StructOfStructsOfStructsReader();
902
903 @override
904 int get size => 20;
905
906 @override
907 StructOfStructsOfStructs createObject(fb.BufferContext bc, int offset) =>
908 StructOfStructsOfStructs._(bc, offset);
909}
910
911class StructOfStructsOfStructsBuilder {
912 StructOfStructsOfStructsBuilder(this.fbBuilder);
913
914 final fb.Builder fbBuilder;
915
916 int finish(fb.StructBuilder a) {
917 a();
918 return fbBuilder.offset;
919 }
920
921}
922
923class StructOfStructsOfStructsObjectBuilder extends fb.ObjectBuilder {
924 final StructOfStructsObjectBuilder _a;
925
926 StructOfStructsOfStructsObjectBuilder({
927 required StructOfStructsObjectBuilder a,
928 })
929 : _a = a;
930
931 /// Finish building, and store into the [fbBuilder].
932 @override
933 int finish(fb.Builder fbBuilder) {
934 _a.finish(fbBuilder);
935 return fbBuilder.offset;
936 }
937
938 /// Convenience method to serialize to byte list.
939 @override
940 Uint8List toBytes([String? fileIdentifier]) {
941 final fbBuilder = fb.Builder(deduplicateTables: false);
942 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
943 return fbBuilder.buffer;
944 }
945}
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700946class Stat {
947 Stat._(this._bc, this._bcOffset);
948 factory Stat(List<int> bytes) {
James Kuszmaul8e62b022022-03-22 09:33:25 -0700949 final rootRef = fb.BufferContext.fromBytes(bytes);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700950 return reader.read(rootRef, 0);
951 }
952
James Kuszmaul8e62b022022-03-22 09:33:25 -0700953 static const fb.Reader<Stat> reader = _StatReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700954
955 final fb.BufferContext _bc;
956 final int _bcOffset;
957
James Kuszmaul8e62b022022-03-22 09:33:25 -0700958 String? get id => const fb.StringReader().vTableGetNullable(_bc, _bcOffset, 4);
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700959 int get val => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 6, 0);
960 int get count => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 8, 0);
961
962 @override
963 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -0700964 return 'Stat{id: ${id}, val: ${val}, count: ${count}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -0700965 }
James Kuszmaul8e62b022022-03-22 09:33:25 -0700966
967 StatT unpack() => StatT(
968 id: id,
969 val: val,
970 count: count);
971
972 static int pack(fb.Builder fbBuilder, StatT? object) {
973 if (object == null) return 0;
974 return object.pack(fbBuilder);
975 }
976}
977
978class StatT implements fb.Packable {
979 String? id;
980 int val;
981 int count;
982
983 StatT({
984 this.id,
985 this.val = 0,
986 this.count = 0});
987
988 @override
989 int pack(fb.Builder fbBuilder) {
990 final int? idOffset = id == null ? null
991 : fbBuilder.writeString(id!);
992 fbBuilder.startTable(3);
993 fbBuilder.addOffset(0, idOffset);
994 fbBuilder.addInt64(1, val);
995 fbBuilder.addUint16(2, count);
996 return fbBuilder.endTable();
997 }
998
999 @override
1000 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001001 return 'StatT{id: ${id}, val: ${val}, count: ${count}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -07001002 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001003}
1004
1005class _StatReader extends fb.TableReader<Stat> {
1006 const _StatReader();
1007
1008 @override
1009 Stat createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -07001010 Stat._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001011}
1012
1013class StatBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001014 StatBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001015
1016 final fb.Builder fbBuilder;
1017
1018 void begin() {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001019 fbBuilder.startTable(3);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001020 }
1021
James Kuszmaul8e62b022022-03-22 09:33:25 -07001022 int addIdOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001023 fbBuilder.addOffset(0, offset);
1024 return fbBuilder.offset;
1025 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001026 int addVal(int? val) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001027 fbBuilder.addInt64(1, val);
1028 return fbBuilder.offset;
1029 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001030 int addCount(int? count) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001031 fbBuilder.addUint16(2, count);
1032 return fbBuilder.offset;
1033 }
1034
1035 int finish() {
1036 return fbBuilder.endTable();
1037 }
1038}
1039
1040class StatObjectBuilder extends fb.ObjectBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001041 final String? _id;
1042 final int? _val;
1043 final int? _count;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001044
1045 StatObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -07001046 String? id,
1047 int? val,
1048 int? count,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001049 })
1050 : _id = id,
1051 _val = val,
1052 _count = count;
1053
1054 /// Finish building, and store into the [fbBuilder].
1055 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07001056 int finish(fb.Builder fbBuilder) {
1057 final int? idOffset = _id == null ? null
1058 : fbBuilder.writeString(_id!);
1059 fbBuilder.startTable(3);
1060 fbBuilder.addOffset(0, idOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001061 fbBuilder.addInt64(1, _val);
1062 fbBuilder.addUint16(2, _count);
1063 return fbBuilder.endTable();
1064 }
1065
1066 /// Convenience method to serialize to byte list.
1067 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07001068 Uint8List toBytes([String? fileIdentifier]) {
1069 final fbBuilder = fb.Builder(deduplicateTables: false);
1070 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
1071 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001072 }
1073}
1074class Referrable {
1075 Referrable._(this._bc, this._bcOffset);
1076 factory Referrable(List<int> bytes) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001077 final rootRef = fb.BufferContext.fromBytes(bytes);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001078 return reader.read(rootRef, 0);
1079 }
1080
James Kuszmaul8e62b022022-03-22 09:33:25 -07001081 static const fb.Reader<Referrable> reader = _ReferrableReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001082
1083 final fb.BufferContext _bc;
1084 final int _bcOffset;
1085
1086 int get id => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 4, 0);
1087
1088 @override
1089 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001090 return 'Referrable{id: ${id}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001091 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001092
1093 ReferrableT unpack() => ReferrableT(
1094 id: id);
1095
1096 static int pack(fb.Builder fbBuilder, ReferrableT? object) {
1097 if (object == null) return 0;
1098 return object.pack(fbBuilder);
1099 }
1100}
1101
1102class ReferrableT implements fb.Packable {
1103 int id;
1104
1105 ReferrableT({
1106 this.id = 0});
1107
1108 @override
1109 int pack(fb.Builder fbBuilder) {
1110 fbBuilder.startTable(1);
1111 fbBuilder.addUint64(0, id);
1112 return fbBuilder.endTable();
1113 }
1114
1115 @override
1116 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001117 return 'ReferrableT{id: ${id}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -07001118 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001119}
1120
1121class _ReferrableReader extends fb.TableReader<Referrable> {
1122 const _ReferrableReader();
1123
1124 @override
1125 Referrable createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -07001126 Referrable._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001127}
1128
1129class ReferrableBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001130 ReferrableBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001131
1132 final fb.Builder fbBuilder;
1133
1134 void begin() {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001135 fbBuilder.startTable(1);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001136 }
1137
James Kuszmaul8e62b022022-03-22 09:33:25 -07001138 int addId(int? id) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001139 fbBuilder.addUint64(0, id);
1140 return fbBuilder.offset;
1141 }
1142
1143 int finish() {
1144 return fbBuilder.endTable();
1145 }
1146}
1147
1148class ReferrableObjectBuilder extends fb.ObjectBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001149 final int? _id;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001150
1151 ReferrableObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -07001152 int? id,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001153 })
1154 : _id = id;
1155
1156 /// Finish building, and store into the [fbBuilder].
1157 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07001158 int finish(fb.Builder fbBuilder) {
1159 fbBuilder.startTable(1);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001160 fbBuilder.addUint64(0, _id);
1161 return fbBuilder.endTable();
1162 }
1163
1164 /// Convenience method to serialize to byte list.
1165 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07001166 Uint8List toBytes([String? fileIdentifier]) {
1167 final fbBuilder = fb.Builder(deduplicateTables: false);
1168 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
1169 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001170 }
1171}
Austin Schuh272c6132020-11-14 16:37:52 -08001172/// an example documentation comment: "monster object"
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001173class Monster {
1174 Monster._(this._bc, this._bcOffset);
1175 factory Monster(List<int> bytes) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001176 final rootRef = fb.BufferContext.fromBytes(bytes);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001177 return reader.read(rootRef, 0);
1178 }
1179
James Kuszmaul8e62b022022-03-22 09:33:25 -07001180 static const fb.Reader<Monster> reader = _MonsterReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001181
1182 final fb.BufferContext _bc;
1183 final int _bcOffset;
1184
James Kuszmaul8e62b022022-03-22 09:33:25 -07001185 Vec3? get pos => Vec3.reader.vTableGetNullable(_bc, _bcOffset, 4);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001186 int get mana => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 6, 150);
1187 int get hp => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 8, 100);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001188 String? get name => const fb.StringReader().vTableGetNullable(_bc, _bcOffset, 10);
1189 List<int>? get inventory => const fb.Uint8ListReader().vTableGetNullable(_bc, _bcOffset, 14);
1190 Color get color => Color.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 16, 8));
1191 AnyTypeId? get testType => AnyTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 18));
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001192 dynamic get test {
1193 switch (testType?.value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001194 case 1: return Monster.reader.vTableGetNullable(_bc, _bcOffset, 20);
1195 case 2: return TestSimpleTableWithEnum.reader.vTableGetNullable(_bc, _bcOffset, 20);
1196 case 3: return my_game_example2.Monster.reader.vTableGetNullable(_bc, _bcOffset, 20);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001197 default: return null;
1198 }
1199 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001200 List<Test>? get test4 => const fb.ListReader<Test>(Test.reader).vTableGetNullable(_bc, _bcOffset, 22);
1201 List<String>? get testarrayofstring => const fb.ListReader<String>(fb.StringReader()).vTableGetNullable(_bc, _bcOffset, 24);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001202 /// an example documentation comment: this will end up in the generated code
1203 /// multiline too
James Kuszmaul8e62b022022-03-22 09:33:25 -07001204 List<Monster>? get testarrayoftables => const fb.ListReader<Monster>(Monster.reader).vTableGetNullable(_bc, _bcOffset, 26);
1205 Monster? get enemy => Monster.reader.vTableGetNullable(_bc, _bcOffset, 28);
1206 List<int>? get testnestedflatbuffer => const fb.Uint8ListReader().vTableGetNullable(_bc, _bcOffset, 30);
1207 Stat? get testempty => Stat.reader.vTableGetNullable(_bc, _bcOffset, 32);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001208 bool get testbool => const fb.BoolReader().vTableGet(_bc, _bcOffset, 34, false);
1209 int get testhashs32Fnv1 => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 36, 0);
1210 int get testhashu32Fnv1 => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 38, 0);
1211 int get testhashs64Fnv1 => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 40, 0);
1212 int get testhashu64Fnv1 => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 42, 0);
1213 int get testhashs32Fnv1a => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 44, 0);
1214 int get testhashu32Fnv1a => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 46, 0);
1215 int get testhashs64Fnv1a => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 48, 0);
1216 int get testhashu64Fnv1a => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 50, 0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001217 List<bool>? get testarrayofbools => const fb.ListReader<bool>(fb.BoolReader()).vTableGetNullable(_bc, _bcOffset, 52);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001218 double get testf => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 54, 3.14159);
1219 double get testf2 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 56, 3.0);
1220 double get testf3 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 58, 0.0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001221 List<String>? get testarrayofstring2 => const fb.ListReader<String>(fb.StringReader()).vTableGetNullable(_bc, _bcOffset, 60);
1222 List<Ability>? get testarrayofsortedstruct => const fb.ListReader<Ability>(Ability.reader).vTableGetNullable(_bc, _bcOffset, 62);
1223 List<int>? get flex => const fb.Uint8ListReader().vTableGetNullable(_bc, _bcOffset, 64);
1224 List<Test>? get test5 => const fb.ListReader<Test>(Test.reader).vTableGetNullable(_bc, _bcOffset, 66);
1225 List<int>? get vectorOfLongs => const fb.ListReader<int>(fb.Int64Reader()).vTableGetNullable(_bc, _bcOffset, 68);
1226 List<double>? get vectorOfDoubles => const fb.ListReader<double>(fb.Float64Reader()).vTableGetNullable(_bc, _bcOffset, 70);
1227 my_game.InParentNamespace? get parentNamespaceTest => my_game.InParentNamespace.reader.vTableGetNullable(_bc, _bcOffset, 72);
1228 List<Referrable>? get vectorOfReferrables => const fb.ListReader<Referrable>(Referrable.reader).vTableGetNullable(_bc, _bcOffset, 74);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001229 int get singleWeakReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 76, 0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001230 List<int>? get vectorOfWeakReferences => const fb.ListReader<int>(fb.Uint64Reader()).vTableGetNullable(_bc, _bcOffset, 78);
1231 List<Referrable>? get vectorOfStrongReferrables => const fb.ListReader<Referrable>(Referrable.reader).vTableGetNullable(_bc, _bcOffset, 80);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001232 int get coOwningReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 82, 0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001233 List<int>? get vectorOfCoOwningReferences => const fb.ListReader<int>(fb.Uint64Reader()).vTableGetNullable(_bc, _bcOffset, 84);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001234 int get nonOwningReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 86, 0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07001235 List<int>? get vectorOfNonOwningReferences => const fb.ListReader<int>(fb.Uint64Reader()).vTableGetNullable(_bc, _bcOffset, 88);
1236 AnyUniqueAliasesTypeId? get anyUniqueType => AnyUniqueAliasesTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 90));
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001237 dynamic get anyUnique {
1238 switch (anyUniqueType?.value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001239 case 1: return Monster.reader.vTableGetNullable(_bc, _bcOffset, 92);
1240 case 2: return TestSimpleTableWithEnum.reader.vTableGetNullable(_bc, _bcOffset, 92);
1241 case 3: return my_game_example2.Monster.reader.vTableGetNullable(_bc, _bcOffset, 92);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001242 default: return null;
1243 }
1244 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001245 AnyAmbiguousAliasesTypeId? get anyAmbiguousType => AnyAmbiguousAliasesTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 94));
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001246 dynamic get anyAmbiguous {
1247 switch (anyAmbiguousType?.value) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001248 case 1: return Monster.reader.vTableGetNullable(_bc, _bcOffset, 96);
1249 case 2: return Monster.reader.vTableGetNullable(_bc, _bcOffset, 96);
1250 case 3: return Monster.reader.vTableGetNullable(_bc, _bcOffset, 96);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001251 default: return null;
1252 }
1253 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001254 List<Color>? get vectorOfEnums => const fb.ListReader<Color>(Color.reader).vTableGetNullable(_bc, _bcOffset, 98);
1255 Race get signedEnum => Race.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 100, -1));
1256 List<int>? get testrequirednestedflatbuffer => const fb.Uint8ListReader().vTableGetNullable(_bc, _bcOffset, 102);
1257 List<Stat>? get scalarKeySortedTables => const fb.ListReader<Stat>(Stat.reader).vTableGetNullable(_bc, _bcOffset, 104);
1258 Test? get nativeInline => Test.reader.vTableGetNullable(_bc, _bcOffset, 106);
1259 LongEnum get longEnumNonEnumDefault => LongEnum.fromValue(const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 108, 0));
1260 LongEnum get longEnumNormalDefault => LongEnum.fromValue(const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 110, 2));
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001261
1262 @override
1263 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001264 return 'Monster{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -07001265 }
1266
1267 MonsterT unpack() => MonsterT(
1268 pos: pos?.unpack(),
1269 mana: mana,
1270 hp: hp,
1271 name: name,
1272 inventory: const fb.Uint8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 14),
1273 color: color,
1274 testType: testType,
1275 test: test,
1276 test4: test4?.map((e) => e.unpack()).toList(),
1277 testarrayofstring: const fb.ListReader<String>(fb.StringReader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 24),
1278 testarrayoftables: testarrayoftables?.map((e) => e.unpack()).toList(),
1279 enemy: enemy?.unpack(),
1280 testnestedflatbuffer: const fb.Uint8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 30),
1281 testempty: testempty?.unpack(),
1282 testbool: testbool,
1283 testhashs32Fnv1: testhashs32Fnv1,
1284 testhashu32Fnv1: testhashu32Fnv1,
1285 testhashs64Fnv1: testhashs64Fnv1,
1286 testhashu64Fnv1: testhashu64Fnv1,
1287 testhashs32Fnv1a: testhashs32Fnv1a,
1288 testhashu32Fnv1a: testhashu32Fnv1a,
1289 testhashs64Fnv1a: testhashs64Fnv1a,
1290 testhashu64Fnv1a: testhashu64Fnv1a,
1291 testarrayofbools: const fb.ListReader<bool>(fb.BoolReader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 52),
1292 testf: testf,
1293 testf2: testf2,
1294 testf3: testf3,
1295 testarrayofstring2: const fb.ListReader<String>(fb.StringReader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 60),
1296 testarrayofsortedstruct: testarrayofsortedstruct?.map((e) => e.unpack()).toList(),
1297 flex: const fb.Uint8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 64),
1298 test5: test5?.map((e) => e.unpack()).toList(),
1299 vectorOfLongs: const fb.ListReader<int>(fb.Int64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 68),
1300 vectorOfDoubles: const fb.ListReader<double>(fb.Float64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 70),
1301 parentNamespaceTest: parentNamespaceTest?.unpack(),
1302 vectorOfReferrables: vectorOfReferrables?.map((e) => e.unpack()).toList(),
1303 singleWeakReference: singleWeakReference,
1304 vectorOfWeakReferences: const fb.ListReader<int>(fb.Uint64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 78),
1305 vectorOfStrongReferrables: vectorOfStrongReferrables?.map((e) => e.unpack()).toList(),
1306 coOwningReference: coOwningReference,
1307 vectorOfCoOwningReferences: const fb.ListReader<int>(fb.Uint64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 84),
1308 nonOwningReference: nonOwningReference,
1309 vectorOfNonOwningReferences: const fb.ListReader<int>(fb.Uint64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 88),
1310 anyUniqueType: anyUniqueType,
1311 anyUnique: anyUnique,
1312 anyAmbiguousType: anyAmbiguousType,
1313 anyAmbiguous: anyAmbiguous,
1314 vectorOfEnums: const fb.ListReader<Color>(Color.reader, lazy: false).vTableGetNullable(_bc, _bcOffset, 98),
1315 signedEnum: signedEnum,
1316 testrequirednestedflatbuffer: const fb.Uint8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 102),
1317 scalarKeySortedTables: scalarKeySortedTables?.map((e) => e.unpack()).toList(),
1318 nativeInline: nativeInline?.unpack(),
1319 longEnumNonEnumDefault: longEnumNonEnumDefault,
1320 longEnumNormalDefault: longEnumNormalDefault);
1321
1322 static int pack(fb.Builder fbBuilder, MonsterT? object) {
1323 if (object == null) return 0;
1324 return object.pack(fbBuilder);
1325 }
1326}
1327
1328/// an example documentation comment: "monster object"
1329class MonsterT implements fb.Packable {
1330 Vec3T? pos;
1331 int mana;
1332 int hp;
1333 String? name;
1334 List<int>? inventory;
1335 Color color;
1336 AnyTypeId? testType;
1337 dynamic test;
1338 List<TestT>? test4;
1339 List<String>? testarrayofstring;
1340 /// an example documentation comment: this will end up in the generated code
1341 /// multiline too
1342 List<MonsterT>? testarrayoftables;
1343 MonsterT? enemy;
1344 List<int>? testnestedflatbuffer;
1345 StatT? testempty;
1346 bool testbool;
1347 int testhashs32Fnv1;
1348 int testhashu32Fnv1;
1349 int testhashs64Fnv1;
1350 int testhashu64Fnv1;
1351 int testhashs32Fnv1a;
1352 int testhashu32Fnv1a;
1353 int testhashs64Fnv1a;
1354 int testhashu64Fnv1a;
1355 List<bool>? testarrayofbools;
1356 double testf;
1357 double testf2;
1358 double testf3;
1359 List<String>? testarrayofstring2;
1360 List<AbilityT>? testarrayofsortedstruct;
1361 List<int>? flex;
1362 List<TestT>? test5;
1363 List<int>? vectorOfLongs;
1364 List<double>? vectorOfDoubles;
1365 my_game.InParentNamespaceT? parentNamespaceTest;
1366 List<ReferrableT>? vectorOfReferrables;
1367 int singleWeakReference;
1368 List<int>? vectorOfWeakReferences;
1369 List<ReferrableT>? vectorOfStrongReferrables;
1370 int coOwningReference;
1371 List<int>? vectorOfCoOwningReferences;
1372 int nonOwningReference;
1373 List<int>? vectorOfNonOwningReferences;
1374 AnyUniqueAliasesTypeId? anyUniqueType;
1375 dynamic anyUnique;
1376 AnyAmbiguousAliasesTypeId? anyAmbiguousType;
1377 dynamic anyAmbiguous;
1378 List<Color>? vectorOfEnums;
1379 Race signedEnum;
1380 List<int>? testrequirednestedflatbuffer;
1381 List<StatT>? scalarKeySortedTables;
1382 TestT? nativeInline;
1383 LongEnum longEnumNonEnumDefault;
1384 LongEnum longEnumNormalDefault;
1385
1386 MonsterT({
1387 this.pos,
1388 this.mana = 150,
1389 this.hp = 100,
1390 this.name,
1391 this.inventory,
1392 this.color = Color.Blue,
1393 this.testType,
1394 this.test,
1395 this.test4,
1396 this.testarrayofstring,
1397 this.testarrayoftables,
1398 this.enemy,
1399 this.testnestedflatbuffer,
1400 this.testempty,
1401 this.testbool = false,
1402 this.testhashs32Fnv1 = 0,
1403 this.testhashu32Fnv1 = 0,
1404 this.testhashs64Fnv1 = 0,
1405 this.testhashu64Fnv1 = 0,
1406 this.testhashs32Fnv1a = 0,
1407 this.testhashu32Fnv1a = 0,
1408 this.testhashs64Fnv1a = 0,
1409 this.testhashu64Fnv1a = 0,
1410 this.testarrayofbools,
1411 this.testf = 3.14159,
1412 this.testf2 = 3.0,
1413 this.testf3 = 0.0,
1414 this.testarrayofstring2,
1415 this.testarrayofsortedstruct,
1416 this.flex,
1417 this.test5,
1418 this.vectorOfLongs,
1419 this.vectorOfDoubles,
1420 this.parentNamespaceTest,
1421 this.vectorOfReferrables,
1422 this.singleWeakReference = 0,
1423 this.vectorOfWeakReferences,
1424 this.vectorOfStrongReferrables,
1425 this.coOwningReference = 0,
1426 this.vectorOfCoOwningReferences,
1427 this.nonOwningReference = 0,
1428 this.vectorOfNonOwningReferences,
1429 this.anyUniqueType,
1430 this.anyUnique,
1431 this.anyAmbiguousType,
1432 this.anyAmbiguous,
1433 this.vectorOfEnums,
1434 this.signedEnum = Race.None,
1435 this.testrequirednestedflatbuffer,
1436 this.scalarKeySortedTables,
1437 this.nativeInline,
1438 this.longEnumNonEnumDefault = const LongEnum._(0),
1439 this.longEnumNormalDefault = LongEnum.LongOne});
1440
1441 @override
1442 int pack(fb.Builder fbBuilder) {
1443 final int? nameOffset = name == null ? null
1444 : fbBuilder.writeString(name!);
1445 final int? inventoryOffset = inventory == null ? null
1446 : fbBuilder.writeListUint8(inventory!);
1447 final int? testOffset = test?.pack(fbBuilder);
1448 int? test4Offset;
1449 if (test4 != null) {
1450 for (var e in test4!) { e.pack(fbBuilder); }
1451 test4Offset = fbBuilder.endStructVector(test4!.length);
1452 }
1453 final int? testarrayofstringOffset = testarrayofstring == null ? null
1454 : fbBuilder.writeList(testarrayofstring!.map(fbBuilder.writeString).toList());
1455 final int? testarrayoftablesOffset = testarrayoftables == null ? null
1456 : fbBuilder.writeList(testarrayoftables!.map((b) => b.pack(fbBuilder)).toList());
1457 final int? enemyOffset = enemy?.pack(fbBuilder);
1458 final int? testnestedflatbufferOffset = testnestedflatbuffer == null ? null
1459 : fbBuilder.writeListUint8(testnestedflatbuffer!);
1460 final int? testemptyOffset = testempty?.pack(fbBuilder);
1461 final int? testarrayofboolsOffset = testarrayofbools == null ? null
1462 : fbBuilder.writeListBool(testarrayofbools!);
1463 final int? testarrayofstring2Offset = testarrayofstring2 == null ? null
1464 : fbBuilder.writeList(testarrayofstring2!.map(fbBuilder.writeString).toList());
1465 int? testarrayofsortedstructOffset;
1466 if (testarrayofsortedstruct != null) {
1467 for (var e in testarrayofsortedstruct!) { e.pack(fbBuilder); }
1468 testarrayofsortedstructOffset = fbBuilder.endStructVector(testarrayofsortedstruct!.length);
1469 }
1470 final int? flexOffset = flex == null ? null
1471 : fbBuilder.writeListUint8(flex!);
1472 int? test5Offset;
1473 if (test5 != null) {
1474 for (var e in test5!) { e.pack(fbBuilder); }
1475 test5Offset = fbBuilder.endStructVector(test5!.length);
1476 }
1477 final int? vectorOfLongsOffset = vectorOfLongs == null ? null
1478 : fbBuilder.writeListInt64(vectorOfLongs!);
1479 final int? vectorOfDoublesOffset = vectorOfDoubles == null ? null
1480 : fbBuilder.writeListFloat64(vectorOfDoubles!);
1481 final int? parentNamespaceTestOffset = parentNamespaceTest?.pack(fbBuilder);
1482 final int? vectorOfReferrablesOffset = vectorOfReferrables == null ? null
1483 : fbBuilder.writeList(vectorOfReferrables!.map((b) => b.pack(fbBuilder)).toList());
1484 final int? vectorOfWeakReferencesOffset = vectorOfWeakReferences == null ? null
1485 : fbBuilder.writeListUint64(vectorOfWeakReferences!);
1486 final int? vectorOfStrongReferrablesOffset = vectorOfStrongReferrables == null ? null
1487 : fbBuilder.writeList(vectorOfStrongReferrables!.map((b) => b.pack(fbBuilder)).toList());
1488 final int? vectorOfCoOwningReferencesOffset = vectorOfCoOwningReferences == null ? null
1489 : fbBuilder.writeListUint64(vectorOfCoOwningReferences!);
1490 final int? vectorOfNonOwningReferencesOffset = vectorOfNonOwningReferences == null ? null
1491 : fbBuilder.writeListUint64(vectorOfNonOwningReferences!);
1492 final int? anyUniqueOffset = anyUnique?.pack(fbBuilder);
1493 final int? anyAmbiguousOffset = anyAmbiguous?.pack(fbBuilder);
1494 final int? vectorOfEnumsOffset = vectorOfEnums == null ? null
1495 : fbBuilder.writeListUint8(vectorOfEnums!.map((f) => f.value).toList());
1496 final int? testrequirednestedflatbufferOffset = testrequirednestedflatbuffer == null ? null
1497 : fbBuilder.writeListUint8(testrequirednestedflatbuffer!);
1498 final int? scalarKeySortedTablesOffset = scalarKeySortedTables == null ? null
1499 : fbBuilder.writeList(scalarKeySortedTables!.map((b) => b.pack(fbBuilder)).toList());
1500 fbBuilder.startTable(54);
1501 if (pos != null) {
1502 fbBuilder.addStruct(0, pos!.pack(fbBuilder));
1503 }
1504 fbBuilder.addInt16(1, mana);
1505 fbBuilder.addInt16(2, hp);
1506 fbBuilder.addOffset(3, nameOffset);
1507 fbBuilder.addOffset(5, inventoryOffset);
1508 fbBuilder.addUint8(6, color.value);
1509 fbBuilder.addUint8(7, testType?.value);
1510 fbBuilder.addOffset(8, testOffset);
1511 fbBuilder.addOffset(9, test4Offset);
1512 fbBuilder.addOffset(10, testarrayofstringOffset);
1513 fbBuilder.addOffset(11, testarrayoftablesOffset);
1514 fbBuilder.addOffset(12, enemyOffset);
1515 fbBuilder.addOffset(13, testnestedflatbufferOffset);
1516 fbBuilder.addOffset(14, testemptyOffset);
1517 fbBuilder.addBool(15, testbool);
1518 fbBuilder.addInt32(16, testhashs32Fnv1);
1519 fbBuilder.addUint32(17, testhashu32Fnv1);
1520 fbBuilder.addInt64(18, testhashs64Fnv1);
1521 fbBuilder.addUint64(19, testhashu64Fnv1);
1522 fbBuilder.addInt32(20, testhashs32Fnv1a);
1523 fbBuilder.addUint32(21, testhashu32Fnv1a);
1524 fbBuilder.addInt64(22, testhashs64Fnv1a);
1525 fbBuilder.addUint64(23, testhashu64Fnv1a);
1526 fbBuilder.addOffset(24, testarrayofboolsOffset);
1527 fbBuilder.addFloat32(25, testf);
1528 fbBuilder.addFloat32(26, testf2);
1529 fbBuilder.addFloat32(27, testf3);
1530 fbBuilder.addOffset(28, testarrayofstring2Offset);
1531 fbBuilder.addOffset(29, testarrayofsortedstructOffset);
1532 fbBuilder.addOffset(30, flexOffset);
1533 fbBuilder.addOffset(31, test5Offset);
1534 fbBuilder.addOffset(32, vectorOfLongsOffset);
1535 fbBuilder.addOffset(33, vectorOfDoublesOffset);
1536 fbBuilder.addOffset(34, parentNamespaceTestOffset);
1537 fbBuilder.addOffset(35, vectorOfReferrablesOffset);
1538 fbBuilder.addUint64(36, singleWeakReference);
1539 fbBuilder.addOffset(37, vectorOfWeakReferencesOffset);
1540 fbBuilder.addOffset(38, vectorOfStrongReferrablesOffset);
1541 fbBuilder.addUint64(39, coOwningReference);
1542 fbBuilder.addOffset(40, vectorOfCoOwningReferencesOffset);
1543 fbBuilder.addUint64(41, nonOwningReference);
1544 fbBuilder.addOffset(42, vectorOfNonOwningReferencesOffset);
1545 fbBuilder.addUint8(43, anyUniqueType?.value);
1546 fbBuilder.addOffset(44, anyUniqueOffset);
1547 fbBuilder.addUint8(45, anyAmbiguousType?.value);
1548 fbBuilder.addOffset(46, anyAmbiguousOffset);
1549 fbBuilder.addOffset(47, vectorOfEnumsOffset);
1550 fbBuilder.addInt8(48, signedEnum.value);
1551 fbBuilder.addOffset(49, testrequirednestedflatbufferOffset);
1552 fbBuilder.addOffset(50, scalarKeySortedTablesOffset);
1553 if (nativeInline != null) {
1554 fbBuilder.addStruct(51, nativeInline!.pack(fbBuilder));
1555 }
1556 fbBuilder.addUint64(52, longEnumNonEnumDefault.value);
1557 fbBuilder.addUint64(53, longEnumNormalDefault.value);
1558 return fbBuilder.endTable();
1559 }
1560
1561 @override
1562 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07001563 return 'MonsterT{pos: ${pos}, mana: ${mana}, hp: ${hp}, name: ${name}, inventory: ${inventory}, color: ${color}, testType: ${testType}, test: ${test}, test4: ${test4}, testarrayofstring: ${testarrayofstring}, testarrayoftables: ${testarrayoftables}, enemy: ${enemy}, testnestedflatbuffer: ${testnestedflatbuffer}, testempty: ${testempty}, testbool: ${testbool}, testhashs32Fnv1: ${testhashs32Fnv1}, testhashu32Fnv1: ${testhashu32Fnv1}, testhashs64Fnv1: ${testhashs64Fnv1}, testhashu64Fnv1: ${testhashu64Fnv1}, testhashs32Fnv1a: ${testhashs32Fnv1a}, testhashu32Fnv1a: ${testhashu32Fnv1a}, testhashs64Fnv1a: ${testhashs64Fnv1a}, testhashu64Fnv1a: ${testhashu64Fnv1a}, testarrayofbools: ${testarrayofbools}, testf: ${testf}, testf2: ${testf2}, testf3: ${testf3}, testarrayofstring2: ${testarrayofstring2}, testarrayofsortedstruct: ${testarrayofsortedstruct}, flex: ${flex}, test5: ${test5}, vectorOfLongs: ${vectorOfLongs}, vectorOfDoubles: ${vectorOfDoubles}, parentNamespaceTest: ${parentNamespaceTest}, vectorOfReferrables: ${vectorOfReferrables}, singleWeakReference: ${singleWeakReference}, vectorOfWeakReferences: ${vectorOfWeakReferences}, vectorOfStrongReferrables: ${vectorOfStrongReferrables}, coOwningReference: ${coOwningReference}, vectorOfCoOwningReferences: ${vectorOfCoOwningReferences}, nonOwningReference: ${nonOwningReference}, vectorOfNonOwningReferences: ${vectorOfNonOwningReferences}, anyUniqueType: ${anyUniqueType}, anyUnique: ${anyUnique}, anyAmbiguousType: ${anyAmbiguousType}, anyAmbiguous: ${anyAmbiguous}, vectorOfEnums: ${vectorOfEnums}, signedEnum: ${signedEnum}, testrequirednestedflatbuffer: ${testrequirednestedflatbuffer}, scalarKeySortedTables: ${scalarKeySortedTables}, nativeInline: ${nativeInline}, longEnumNonEnumDefault: ${longEnumNonEnumDefault}, longEnumNormalDefault: ${longEnumNormalDefault}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001564 }
1565}
1566
1567class _MonsterReader extends fb.TableReader<Monster> {
1568 const _MonsterReader();
1569
1570 @override
1571 Monster createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -07001572 Monster._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001573}
1574
1575class MonsterBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001576 MonsterBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001577
1578 final fb.Builder fbBuilder;
1579
1580 void begin() {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001581 fbBuilder.startTable(54);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001582 }
1583
1584 int addPos(int offset) {
1585 fbBuilder.addStruct(0, offset);
1586 return fbBuilder.offset;
1587 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001588 int addMana(int? mana) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001589 fbBuilder.addInt16(1, mana);
1590 return fbBuilder.offset;
1591 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001592 int addHp(int? hp) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001593 fbBuilder.addInt16(2, hp);
1594 return fbBuilder.offset;
1595 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001596 int addNameOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001597 fbBuilder.addOffset(3, offset);
1598 return fbBuilder.offset;
1599 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001600 int addInventoryOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001601 fbBuilder.addOffset(5, offset);
1602 return fbBuilder.offset;
1603 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001604 int addColor(Color? color) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001605 fbBuilder.addUint8(6, color?.value);
1606 return fbBuilder.offset;
1607 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001608 int addTestType(AnyTypeId? testType) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001609 fbBuilder.addUint8(7, testType?.value);
1610 return fbBuilder.offset;
1611 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001612 int addTestOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001613 fbBuilder.addOffset(8, offset);
1614 return fbBuilder.offset;
1615 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001616 int addTest4Offset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001617 fbBuilder.addOffset(9, offset);
1618 return fbBuilder.offset;
1619 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001620 int addTestarrayofstringOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001621 fbBuilder.addOffset(10, offset);
1622 return fbBuilder.offset;
1623 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001624 int addTestarrayoftablesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001625 fbBuilder.addOffset(11, offset);
1626 return fbBuilder.offset;
1627 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001628 int addEnemyOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001629 fbBuilder.addOffset(12, offset);
1630 return fbBuilder.offset;
1631 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001632 int addTestnestedflatbufferOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001633 fbBuilder.addOffset(13, offset);
1634 return fbBuilder.offset;
1635 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001636 int addTestemptyOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001637 fbBuilder.addOffset(14, offset);
1638 return fbBuilder.offset;
1639 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001640 int addTestbool(bool? testbool) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001641 fbBuilder.addBool(15, testbool);
1642 return fbBuilder.offset;
1643 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001644 int addTesthashs32Fnv1(int? testhashs32Fnv1) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001645 fbBuilder.addInt32(16, testhashs32Fnv1);
1646 return fbBuilder.offset;
1647 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001648 int addTesthashu32Fnv1(int? testhashu32Fnv1) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001649 fbBuilder.addUint32(17, testhashu32Fnv1);
1650 return fbBuilder.offset;
1651 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001652 int addTesthashs64Fnv1(int? testhashs64Fnv1) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001653 fbBuilder.addInt64(18, testhashs64Fnv1);
1654 return fbBuilder.offset;
1655 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001656 int addTesthashu64Fnv1(int? testhashu64Fnv1) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001657 fbBuilder.addUint64(19, testhashu64Fnv1);
1658 return fbBuilder.offset;
1659 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001660 int addTesthashs32Fnv1a(int? testhashs32Fnv1a) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001661 fbBuilder.addInt32(20, testhashs32Fnv1a);
1662 return fbBuilder.offset;
1663 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001664 int addTesthashu32Fnv1a(int? testhashu32Fnv1a) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001665 fbBuilder.addUint32(21, testhashu32Fnv1a);
1666 return fbBuilder.offset;
1667 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001668 int addTesthashs64Fnv1a(int? testhashs64Fnv1a) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001669 fbBuilder.addInt64(22, testhashs64Fnv1a);
1670 return fbBuilder.offset;
1671 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001672 int addTesthashu64Fnv1a(int? testhashu64Fnv1a) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001673 fbBuilder.addUint64(23, testhashu64Fnv1a);
1674 return fbBuilder.offset;
1675 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001676 int addTestarrayofboolsOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001677 fbBuilder.addOffset(24, offset);
1678 return fbBuilder.offset;
1679 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001680 int addTestf(double? testf) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001681 fbBuilder.addFloat32(25, testf);
1682 return fbBuilder.offset;
1683 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001684 int addTestf2(double? testf2) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001685 fbBuilder.addFloat32(26, testf2);
1686 return fbBuilder.offset;
1687 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001688 int addTestf3(double? testf3) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001689 fbBuilder.addFloat32(27, testf3);
1690 return fbBuilder.offset;
1691 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001692 int addTestarrayofstring2Offset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001693 fbBuilder.addOffset(28, offset);
1694 return fbBuilder.offset;
1695 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001696 int addTestarrayofsortedstructOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001697 fbBuilder.addOffset(29, offset);
1698 return fbBuilder.offset;
1699 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001700 int addFlexOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001701 fbBuilder.addOffset(30, offset);
1702 return fbBuilder.offset;
1703 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001704 int addTest5Offset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001705 fbBuilder.addOffset(31, offset);
1706 return fbBuilder.offset;
1707 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001708 int addVectorOfLongsOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001709 fbBuilder.addOffset(32, offset);
1710 return fbBuilder.offset;
1711 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001712 int addVectorOfDoublesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001713 fbBuilder.addOffset(33, offset);
1714 return fbBuilder.offset;
1715 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001716 int addParentNamespaceTestOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001717 fbBuilder.addOffset(34, offset);
1718 return fbBuilder.offset;
1719 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001720 int addVectorOfReferrablesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001721 fbBuilder.addOffset(35, offset);
1722 return fbBuilder.offset;
1723 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001724 int addSingleWeakReference(int? singleWeakReference) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001725 fbBuilder.addUint64(36, singleWeakReference);
1726 return fbBuilder.offset;
1727 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001728 int addVectorOfWeakReferencesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001729 fbBuilder.addOffset(37, offset);
1730 return fbBuilder.offset;
1731 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001732 int addVectorOfStrongReferrablesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001733 fbBuilder.addOffset(38, offset);
1734 return fbBuilder.offset;
1735 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001736 int addCoOwningReference(int? coOwningReference) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001737 fbBuilder.addUint64(39, coOwningReference);
1738 return fbBuilder.offset;
1739 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001740 int addVectorOfCoOwningReferencesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001741 fbBuilder.addOffset(40, offset);
1742 return fbBuilder.offset;
1743 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001744 int addNonOwningReference(int? nonOwningReference) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001745 fbBuilder.addUint64(41, nonOwningReference);
1746 return fbBuilder.offset;
1747 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001748 int addVectorOfNonOwningReferencesOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001749 fbBuilder.addOffset(42, offset);
1750 return fbBuilder.offset;
1751 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001752 int addAnyUniqueType(AnyUniqueAliasesTypeId? anyUniqueType) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001753 fbBuilder.addUint8(43, anyUniqueType?.value);
1754 return fbBuilder.offset;
1755 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001756 int addAnyUniqueOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001757 fbBuilder.addOffset(44, offset);
1758 return fbBuilder.offset;
1759 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001760 int addAnyAmbiguousType(AnyAmbiguousAliasesTypeId? anyAmbiguousType) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001761 fbBuilder.addUint8(45, anyAmbiguousType?.value);
1762 return fbBuilder.offset;
1763 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001764 int addAnyAmbiguousOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001765 fbBuilder.addOffset(46, offset);
1766 return fbBuilder.offset;
1767 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001768 int addVectorOfEnumsOffset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001769 fbBuilder.addOffset(47, offset);
1770 return fbBuilder.offset;
1771 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001772 int addSignedEnum(Race? signedEnum) {
Austin Schuh272c6132020-11-14 16:37:52 -08001773 fbBuilder.addInt8(48, signedEnum?.value);
1774 return fbBuilder.offset;
1775 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001776 int addTestrequirednestedflatbufferOffset(int? offset) {
Austin Schuh272c6132020-11-14 16:37:52 -08001777 fbBuilder.addOffset(49, offset);
1778 return fbBuilder.offset;
1779 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07001780 int addScalarKeySortedTablesOffset(int? offset) {
1781 fbBuilder.addOffset(50, offset);
1782 return fbBuilder.offset;
1783 }
1784 int addNativeInline(int offset) {
1785 fbBuilder.addStruct(51, offset);
1786 return fbBuilder.offset;
1787 }
1788 int addLongEnumNonEnumDefault(LongEnum? longEnumNonEnumDefault) {
1789 fbBuilder.addUint64(52, longEnumNonEnumDefault?.value);
1790 return fbBuilder.offset;
1791 }
1792 int addLongEnumNormalDefault(LongEnum? longEnumNormalDefault) {
1793 fbBuilder.addUint64(53, longEnumNormalDefault?.value);
1794 return fbBuilder.offset;
1795 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001796
1797 int finish() {
1798 return fbBuilder.endTable();
1799 }
1800}
1801
1802class MonsterObjectBuilder extends fb.ObjectBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07001803 final Vec3ObjectBuilder? _pos;
1804 final int? _mana;
1805 final int? _hp;
1806 final String? _name;
1807 final List<int>? _inventory;
1808 final Color? _color;
1809 final AnyTypeId? _testType;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001810 final dynamic _test;
James Kuszmaul8e62b022022-03-22 09:33:25 -07001811 final List<TestObjectBuilder>? _test4;
1812 final List<String>? _testarrayofstring;
1813 final List<MonsterObjectBuilder>? _testarrayoftables;
1814 final MonsterObjectBuilder? _enemy;
1815 final List<int>? _testnestedflatbuffer;
1816 final StatObjectBuilder? _testempty;
1817 final bool? _testbool;
1818 final int? _testhashs32Fnv1;
1819 final int? _testhashu32Fnv1;
1820 final int? _testhashs64Fnv1;
1821 final int? _testhashu64Fnv1;
1822 final int? _testhashs32Fnv1a;
1823 final int? _testhashu32Fnv1a;
1824 final int? _testhashs64Fnv1a;
1825 final int? _testhashu64Fnv1a;
1826 final List<bool>? _testarrayofbools;
1827 final double? _testf;
1828 final double? _testf2;
1829 final double? _testf3;
1830 final List<String>? _testarrayofstring2;
1831 final List<AbilityObjectBuilder>? _testarrayofsortedstruct;
1832 final List<int>? _flex;
1833 final List<TestObjectBuilder>? _test5;
1834 final List<int>? _vectorOfLongs;
1835 final List<double>? _vectorOfDoubles;
1836 final my_game.InParentNamespaceObjectBuilder? _parentNamespaceTest;
1837 final List<ReferrableObjectBuilder>? _vectorOfReferrables;
1838 final int? _singleWeakReference;
1839 final List<int>? _vectorOfWeakReferences;
1840 final List<ReferrableObjectBuilder>? _vectorOfStrongReferrables;
1841 final int? _coOwningReference;
1842 final List<int>? _vectorOfCoOwningReferences;
1843 final int? _nonOwningReference;
1844 final List<int>? _vectorOfNonOwningReferences;
1845 final AnyUniqueAliasesTypeId? _anyUniqueType;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001846 final dynamic _anyUnique;
James Kuszmaul8e62b022022-03-22 09:33:25 -07001847 final AnyAmbiguousAliasesTypeId? _anyAmbiguousType;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001848 final dynamic _anyAmbiguous;
James Kuszmaul8e62b022022-03-22 09:33:25 -07001849 final List<Color>? _vectorOfEnums;
1850 final Race? _signedEnum;
1851 final List<int>? _testrequirednestedflatbuffer;
1852 final List<StatObjectBuilder>? _scalarKeySortedTables;
1853 final TestObjectBuilder? _nativeInline;
1854 final LongEnum? _longEnumNonEnumDefault;
1855 final LongEnum? _longEnumNormalDefault;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001856
1857 MonsterObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -07001858 Vec3ObjectBuilder? pos,
1859 int? mana,
1860 int? hp,
1861 String? name,
1862 List<int>? inventory,
1863 Color? color,
1864 AnyTypeId? testType,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001865 dynamic test,
James Kuszmaul8e62b022022-03-22 09:33:25 -07001866 List<TestObjectBuilder>? test4,
1867 List<String>? testarrayofstring,
1868 List<MonsterObjectBuilder>? testarrayoftables,
1869 MonsterObjectBuilder? enemy,
1870 List<int>? testnestedflatbuffer,
1871 StatObjectBuilder? testempty,
1872 bool? testbool,
1873 int? testhashs32Fnv1,
1874 int? testhashu32Fnv1,
1875 int? testhashs64Fnv1,
1876 int? testhashu64Fnv1,
1877 int? testhashs32Fnv1a,
1878 int? testhashu32Fnv1a,
1879 int? testhashs64Fnv1a,
1880 int? testhashu64Fnv1a,
1881 List<bool>? testarrayofbools,
1882 double? testf,
1883 double? testf2,
1884 double? testf3,
1885 List<String>? testarrayofstring2,
1886 List<AbilityObjectBuilder>? testarrayofsortedstruct,
1887 List<int>? flex,
1888 List<TestObjectBuilder>? test5,
1889 List<int>? vectorOfLongs,
1890 List<double>? vectorOfDoubles,
1891 my_game.InParentNamespaceObjectBuilder? parentNamespaceTest,
1892 List<ReferrableObjectBuilder>? vectorOfReferrables,
1893 int? singleWeakReference,
1894 List<int>? vectorOfWeakReferences,
1895 List<ReferrableObjectBuilder>? vectorOfStrongReferrables,
1896 int? coOwningReference,
1897 List<int>? vectorOfCoOwningReferences,
1898 int? nonOwningReference,
1899 List<int>? vectorOfNonOwningReferences,
1900 AnyUniqueAliasesTypeId? anyUniqueType,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001901 dynamic anyUnique,
James Kuszmaul8e62b022022-03-22 09:33:25 -07001902 AnyAmbiguousAliasesTypeId? anyAmbiguousType,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001903 dynamic anyAmbiguous,
James Kuszmaul8e62b022022-03-22 09:33:25 -07001904 List<Color>? vectorOfEnums,
1905 Race? signedEnum,
1906 List<int>? testrequirednestedflatbuffer,
1907 List<StatObjectBuilder>? scalarKeySortedTables,
1908 TestObjectBuilder? nativeInline,
1909 LongEnum? longEnumNonEnumDefault,
1910 LongEnum? longEnumNormalDefault,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001911 })
1912 : _pos = pos,
1913 _mana = mana,
1914 _hp = hp,
1915 _name = name,
1916 _inventory = inventory,
1917 _color = color,
1918 _testType = testType,
1919 _test = test,
1920 _test4 = test4,
1921 _testarrayofstring = testarrayofstring,
1922 _testarrayoftables = testarrayoftables,
1923 _enemy = enemy,
1924 _testnestedflatbuffer = testnestedflatbuffer,
1925 _testempty = testempty,
1926 _testbool = testbool,
1927 _testhashs32Fnv1 = testhashs32Fnv1,
1928 _testhashu32Fnv1 = testhashu32Fnv1,
1929 _testhashs64Fnv1 = testhashs64Fnv1,
1930 _testhashu64Fnv1 = testhashu64Fnv1,
1931 _testhashs32Fnv1a = testhashs32Fnv1a,
1932 _testhashu32Fnv1a = testhashu32Fnv1a,
1933 _testhashs64Fnv1a = testhashs64Fnv1a,
1934 _testhashu64Fnv1a = testhashu64Fnv1a,
1935 _testarrayofbools = testarrayofbools,
1936 _testf = testf,
1937 _testf2 = testf2,
1938 _testf3 = testf3,
1939 _testarrayofstring2 = testarrayofstring2,
1940 _testarrayofsortedstruct = testarrayofsortedstruct,
1941 _flex = flex,
1942 _test5 = test5,
1943 _vectorOfLongs = vectorOfLongs,
1944 _vectorOfDoubles = vectorOfDoubles,
1945 _parentNamespaceTest = parentNamespaceTest,
1946 _vectorOfReferrables = vectorOfReferrables,
1947 _singleWeakReference = singleWeakReference,
1948 _vectorOfWeakReferences = vectorOfWeakReferences,
1949 _vectorOfStrongReferrables = vectorOfStrongReferrables,
1950 _coOwningReference = coOwningReference,
1951 _vectorOfCoOwningReferences = vectorOfCoOwningReferences,
1952 _nonOwningReference = nonOwningReference,
1953 _vectorOfNonOwningReferences = vectorOfNonOwningReferences,
1954 _anyUniqueType = anyUniqueType,
1955 _anyUnique = anyUnique,
1956 _anyAmbiguousType = anyAmbiguousType,
1957 _anyAmbiguous = anyAmbiguous,
Austin Schuh272c6132020-11-14 16:37:52 -08001958 _vectorOfEnums = vectorOfEnums,
1959 _signedEnum = signedEnum,
James Kuszmaul8e62b022022-03-22 09:33:25 -07001960 _testrequirednestedflatbuffer = testrequirednestedflatbuffer,
1961 _scalarKeySortedTables = scalarKeySortedTables,
1962 _nativeInline = nativeInline,
1963 _longEnumNonEnumDefault = longEnumNonEnumDefault,
1964 _longEnumNormalDefault = longEnumNormalDefault;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001965
1966 /// Finish building, and store into the [fbBuilder].
1967 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07001968 int finish(fb.Builder fbBuilder) {
1969 final int? nameOffset = _name == null ? null
1970 : fbBuilder.writeString(_name!);
1971 final int? inventoryOffset = _inventory == null ? null
1972 : fbBuilder.writeListUint8(_inventory!);
1973 final int? testOffset = _test?.getOrCreateOffset(fbBuilder);
1974 final int? test4Offset = _test4 == null ? null
1975 : fbBuilder.writeListOfStructs(_test4!);
1976 final int? testarrayofstringOffset = _testarrayofstring == null ? null
1977 : fbBuilder.writeList(_testarrayofstring!.map(fbBuilder.writeString).toList());
1978 final int? testarrayoftablesOffset = _testarrayoftables == null ? null
1979 : fbBuilder.writeList(_testarrayoftables!.map((b) => b.getOrCreateOffset(fbBuilder)).toList());
1980 final int? enemyOffset = _enemy?.getOrCreateOffset(fbBuilder);
1981 final int? testnestedflatbufferOffset = _testnestedflatbuffer == null ? null
1982 : fbBuilder.writeListUint8(_testnestedflatbuffer!);
1983 final int? testemptyOffset = _testempty?.getOrCreateOffset(fbBuilder);
1984 final int? testarrayofboolsOffset = _testarrayofbools == null ? null
1985 : fbBuilder.writeListBool(_testarrayofbools!);
1986 final int? testarrayofstring2Offset = _testarrayofstring2 == null ? null
1987 : fbBuilder.writeList(_testarrayofstring2!.map(fbBuilder.writeString).toList());
1988 final int? testarrayofsortedstructOffset = _testarrayofsortedstruct == null ? null
1989 : fbBuilder.writeListOfStructs(_testarrayofsortedstruct!);
1990 final int? flexOffset = _flex == null ? null
1991 : fbBuilder.writeListUint8(_flex!);
1992 final int? test5Offset = _test5 == null ? null
1993 : fbBuilder.writeListOfStructs(_test5!);
1994 final int? vectorOfLongsOffset = _vectorOfLongs == null ? null
1995 : fbBuilder.writeListInt64(_vectorOfLongs!);
1996 final int? vectorOfDoublesOffset = _vectorOfDoubles == null ? null
1997 : fbBuilder.writeListFloat64(_vectorOfDoubles!);
1998 final int? parentNamespaceTestOffset = _parentNamespaceTest?.getOrCreateOffset(fbBuilder);
1999 final int? vectorOfReferrablesOffset = _vectorOfReferrables == null ? null
2000 : fbBuilder.writeList(_vectorOfReferrables!.map((b) => b.getOrCreateOffset(fbBuilder)).toList());
2001 final int? vectorOfWeakReferencesOffset = _vectorOfWeakReferences == null ? null
2002 : fbBuilder.writeListUint64(_vectorOfWeakReferences!);
2003 final int? vectorOfStrongReferrablesOffset = _vectorOfStrongReferrables == null ? null
2004 : fbBuilder.writeList(_vectorOfStrongReferrables!.map((b) => b.getOrCreateOffset(fbBuilder)).toList());
2005 final int? vectorOfCoOwningReferencesOffset = _vectorOfCoOwningReferences == null ? null
2006 : fbBuilder.writeListUint64(_vectorOfCoOwningReferences!);
2007 final int? vectorOfNonOwningReferencesOffset = _vectorOfNonOwningReferences == null ? null
2008 : fbBuilder.writeListUint64(_vectorOfNonOwningReferences!);
2009 final int? anyUniqueOffset = _anyUnique?.getOrCreateOffset(fbBuilder);
2010 final int? anyAmbiguousOffset = _anyAmbiguous?.getOrCreateOffset(fbBuilder);
2011 final int? vectorOfEnumsOffset = _vectorOfEnums == null ? null
2012 : fbBuilder.writeListUint8(_vectorOfEnums!.map((f) => f.value).toList());
2013 final int? testrequirednestedflatbufferOffset = _testrequirednestedflatbuffer == null ? null
2014 : fbBuilder.writeListUint8(_testrequirednestedflatbuffer!);
2015 final int? scalarKeySortedTablesOffset = _scalarKeySortedTables == null ? null
2016 : fbBuilder.writeList(_scalarKeySortedTables!.map((b) => b.getOrCreateOffset(fbBuilder)).toList());
2017 fbBuilder.startTable(54);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002018 if (_pos != null) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07002019 fbBuilder.addStruct(0, _pos!.finish(fbBuilder));
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002020 }
2021 fbBuilder.addInt16(1, _mana);
2022 fbBuilder.addInt16(2, _hp);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002023 fbBuilder.addOffset(3, nameOffset);
2024 fbBuilder.addOffset(5, inventoryOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002025 fbBuilder.addUint8(6, _color?.value);
2026 fbBuilder.addUint8(7, _testType?.value);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002027 fbBuilder.addOffset(8, testOffset);
2028 fbBuilder.addOffset(9, test4Offset);
2029 fbBuilder.addOffset(10, testarrayofstringOffset);
2030 fbBuilder.addOffset(11, testarrayoftablesOffset);
2031 fbBuilder.addOffset(12, enemyOffset);
2032 fbBuilder.addOffset(13, testnestedflatbufferOffset);
2033 fbBuilder.addOffset(14, testemptyOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002034 fbBuilder.addBool(15, _testbool);
2035 fbBuilder.addInt32(16, _testhashs32Fnv1);
2036 fbBuilder.addUint32(17, _testhashu32Fnv1);
2037 fbBuilder.addInt64(18, _testhashs64Fnv1);
2038 fbBuilder.addUint64(19, _testhashu64Fnv1);
2039 fbBuilder.addInt32(20, _testhashs32Fnv1a);
2040 fbBuilder.addUint32(21, _testhashu32Fnv1a);
2041 fbBuilder.addInt64(22, _testhashs64Fnv1a);
2042 fbBuilder.addUint64(23, _testhashu64Fnv1a);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002043 fbBuilder.addOffset(24, testarrayofboolsOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002044 fbBuilder.addFloat32(25, _testf);
2045 fbBuilder.addFloat32(26, _testf2);
2046 fbBuilder.addFloat32(27, _testf3);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002047 fbBuilder.addOffset(28, testarrayofstring2Offset);
2048 fbBuilder.addOffset(29, testarrayofsortedstructOffset);
2049 fbBuilder.addOffset(30, flexOffset);
2050 fbBuilder.addOffset(31, test5Offset);
2051 fbBuilder.addOffset(32, vectorOfLongsOffset);
2052 fbBuilder.addOffset(33, vectorOfDoublesOffset);
2053 fbBuilder.addOffset(34, parentNamespaceTestOffset);
2054 fbBuilder.addOffset(35, vectorOfReferrablesOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002055 fbBuilder.addUint64(36, _singleWeakReference);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002056 fbBuilder.addOffset(37, vectorOfWeakReferencesOffset);
2057 fbBuilder.addOffset(38, vectorOfStrongReferrablesOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002058 fbBuilder.addUint64(39, _coOwningReference);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002059 fbBuilder.addOffset(40, vectorOfCoOwningReferencesOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002060 fbBuilder.addUint64(41, _nonOwningReference);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002061 fbBuilder.addOffset(42, vectorOfNonOwningReferencesOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002062 fbBuilder.addUint8(43, _anyUniqueType?.value);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002063 fbBuilder.addOffset(44, anyUniqueOffset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002064 fbBuilder.addUint8(45, _anyAmbiguousType?.value);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002065 fbBuilder.addOffset(46, anyAmbiguousOffset);
2066 fbBuilder.addOffset(47, vectorOfEnumsOffset);
Austin Schuh272c6132020-11-14 16:37:52 -08002067 fbBuilder.addInt8(48, _signedEnum?.value);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002068 fbBuilder.addOffset(49, testrequirednestedflatbufferOffset);
2069 fbBuilder.addOffset(50, scalarKeySortedTablesOffset);
2070 if (_nativeInline != null) {
2071 fbBuilder.addStruct(51, _nativeInline!.finish(fbBuilder));
Austin Schuh272c6132020-11-14 16:37:52 -08002072 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002073 fbBuilder.addUint64(52, _longEnumNonEnumDefault?.value);
2074 fbBuilder.addUint64(53, _longEnumNormalDefault?.value);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002075 return fbBuilder.endTable();
2076 }
2077
2078 /// Convenience method to serialize to byte list.
2079 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07002080 Uint8List toBytes([String? fileIdentifier]) {
2081 final fbBuilder = fb.Builder(deduplicateTables: false);
2082 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
2083 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002084 }
2085}
2086class TypeAliases {
2087 TypeAliases._(this._bc, this._bcOffset);
2088 factory TypeAliases(List<int> bytes) {
James Kuszmaul8e62b022022-03-22 09:33:25 -07002089 final rootRef = fb.BufferContext.fromBytes(bytes);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002090 return reader.read(rootRef, 0);
2091 }
2092
James Kuszmaul8e62b022022-03-22 09:33:25 -07002093 static const fb.Reader<TypeAliases> reader = _TypeAliasesReader();
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002094
2095 final fb.BufferContext _bc;
2096 final int _bcOffset;
2097
2098 int get i8 => const fb.Int8Reader().vTableGet(_bc, _bcOffset, 4, 0);
2099 int get u8 => const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 6, 0);
2100 int get i16 => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 8, 0);
2101 int get u16 => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 10, 0);
2102 int get i32 => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 12, 0);
2103 int get u32 => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 14, 0);
2104 int get i64 => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 16, 0);
2105 int get u64 => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 18, 0);
2106 double get f32 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 20, 0.0);
2107 double get f64 => const fb.Float64Reader().vTableGet(_bc, _bcOffset, 22, 0.0);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002108 List<int>? get v8 => const fb.Int8ListReader().vTableGetNullable(_bc, _bcOffset, 24);
2109 List<double>? get vf64 => const fb.ListReader<double>(fb.Float64Reader()).vTableGetNullable(_bc, _bcOffset, 26);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002110
2111 @override
2112 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07002113 return 'TypeAliases{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002114 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002115
2116 TypeAliasesT unpack() => TypeAliasesT(
2117 i8: i8,
2118 u8: u8,
2119 i16: i16,
2120 u16: u16,
2121 i32: i32,
2122 u32: u32,
2123 i64: i64,
2124 u64: u64,
2125 f32: f32,
2126 f64: f64,
2127 v8: const fb.Int8ListReader(lazy: false).vTableGetNullable(_bc, _bcOffset, 24),
2128 vf64: const fb.ListReader<double>(fb.Float64Reader(), lazy: false).vTableGetNullable(_bc, _bcOffset, 26));
2129
2130 static int pack(fb.Builder fbBuilder, TypeAliasesT? object) {
2131 if (object == null) return 0;
2132 return object.pack(fbBuilder);
2133 }
2134}
2135
2136class TypeAliasesT implements fb.Packable {
2137 int i8;
2138 int u8;
2139 int i16;
2140 int u16;
2141 int i32;
2142 int u32;
2143 int i64;
2144 int u64;
2145 double f32;
2146 double f64;
2147 List<int>? v8;
2148 List<double>? vf64;
2149
2150 TypeAliasesT({
2151 this.i8 = 0,
2152 this.u8 = 0,
2153 this.i16 = 0,
2154 this.u16 = 0,
2155 this.i32 = 0,
2156 this.u32 = 0,
2157 this.i64 = 0,
2158 this.u64 = 0,
2159 this.f32 = 0.0,
2160 this.f64 = 0.0,
2161 this.v8,
2162 this.vf64});
2163
2164 @override
2165 int pack(fb.Builder fbBuilder) {
2166 final int? v8Offset = v8 == null ? null
2167 : fbBuilder.writeListInt8(v8!);
2168 final int? vf64Offset = vf64 == null ? null
2169 : fbBuilder.writeListFloat64(vf64!);
2170 fbBuilder.startTable(12);
2171 fbBuilder.addInt8(0, i8);
2172 fbBuilder.addUint8(1, u8);
2173 fbBuilder.addInt16(2, i16);
2174 fbBuilder.addUint16(3, u16);
2175 fbBuilder.addInt32(4, i32);
2176 fbBuilder.addUint32(5, u32);
2177 fbBuilder.addInt64(6, i64);
2178 fbBuilder.addUint64(7, u64);
2179 fbBuilder.addFloat32(8, f32);
2180 fbBuilder.addFloat64(9, f64);
2181 fbBuilder.addOffset(10, v8Offset);
2182 fbBuilder.addOffset(11, vf64Offset);
2183 return fbBuilder.endTable();
2184 }
2185
2186 @override
2187 String toString() {
Austin Schuh2dd86a92022-09-14 21:19:23 -07002188 return 'TypeAliasesT{i8: ${i8}, u8: ${u8}, i16: ${i16}, u16: ${u16}, i32: ${i32}, u32: ${u32}, i64: ${i64}, u64: ${u64}, f32: ${f32}, f64: ${f64}, v8: ${v8}, vf64: ${vf64}}';
James Kuszmaul8e62b022022-03-22 09:33:25 -07002189 }
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002190}
2191
2192class _TypeAliasesReader extends fb.TableReader<TypeAliases> {
2193 const _TypeAliasesReader();
2194
2195 @override
2196 TypeAliases createObject(fb.BufferContext bc, int offset) =>
James Kuszmaul8e62b022022-03-22 09:33:25 -07002197 TypeAliases._(bc, offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002198}
2199
2200class TypeAliasesBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07002201 TypeAliasesBuilder(this.fbBuilder);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002202
2203 final fb.Builder fbBuilder;
2204
2205 void begin() {
James Kuszmaul8e62b022022-03-22 09:33:25 -07002206 fbBuilder.startTable(12);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002207 }
2208
James Kuszmaul8e62b022022-03-22 09:33:25 -07002209 int addI8(int? i8) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002210 fbBuilder.addInt8(0, i8);
2211 return fbBuilder.offset;
2212 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002213 int addU8(int? u8) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002214 fbBuilder.addUint8(1, u8);
2215 return fbBuilder.offset;
2216 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002217 int addI16(int? i16) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002218 fbBuilder.addInt16(2, i16);
2219 return fbBuilder.offset;
2220 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002221 int addU16(int? u16) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002222 fbBuilder.addUint16(3, u16);
2223 return fbBuilder.offset;
2224 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002225 int addI32(int? i32) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002226 fbBuilder.addInt32(4, i32);
2227 return fbBuilder.offset;
2228 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002229 int addU32(int? u32) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002230 fbBuilder.addUint32(5, u32);
2231 return fbBuilder.offset;
2232 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002233 int addI64(int? i64) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002234 fbBuilder.addInt64(6, i64);
2235 return fbBuilder.offset;
2236 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002237 int addU64(int? u64) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002238 fbBuilder.addUint64(7, u64);
2239 return fbBuilder.offset;
2240 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002241 int addF32(double? f32) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002242 fbBuilder.addFloat32(8, f32);
2243 return fbBuilder.offset;
2244 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002245 int addF64(double? f64) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002246 fbBuilder.addFloat64(9, f64);
2247 return fbBuilder.offset;
2248 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002249 int addV8Offset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002250 fbBuilder.addOffset(10, offset);
2251 return fbBuilder.offset;
2252 }
James Kuszmaul8e62b022022-03-22 09:33:25 -07002253 int addVf64Offset(int? offset) {
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002254 fbBuilder.addOffset(11, offset);
2255 return fbBuilder.offset;
2256 }
2257
2258 int finish() {
2259 return fbBuilder.endTable();
2260 }
2261}
2262
2263class TypeAliasesObjectBuilder extends fb.ObjectBuilder {
James Kuszmaul8e62b022022-03-22 09:33:25 -07002264 final int? _i8;
2265 final int? _u8;
2266 final int? _i16;
2267 final int? _u16;
2268 final int? _i32;
2269 final int? _u32;
2270 final int? _i64;
2271 final int? _u64;
2272 final double? _f32;
2273 final double? _f64;
2274 final List<int>? _v8;
2275 final List<double>? _vf64;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002276
2277 TypeAliasesObjectBuilder({
James Kuszmaul8e62b022022-03-22 09:33:25 -07002278 int? i8,
2279 int? u8,
2280 int? i16,
2281 int? u16,
2282 int? i32,
2283 int? u32,
2284 int? i64,
2285 int? u64,
2286 double? f32,
2287 double? f64,
2288 List<int>? v8,
2289 List<double>? vf64,
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002290 })
2291 : _i8 = i8,
2292 _u8 = u8,
2293 _i16 = i16,
2294 _u16 = u16,
2295 _i32 = i32,
2296 _u32 = u32,
2297 _i64 = i64,
2298 _u64 = u64,
2299 _f32 = f32,
2300 _f64 = f64,
2301 _v8 = v8,
2302 _vf64 = vf64;
2303
2304 /// Finish building, and store into the [fbBuilder].
2305 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07002306 int finish(fb.Builder fbBuilder) {
2307 final int? v8Offset = _v8 == null ? null
2308 : fbBuilder.writeListInt8(_v8!);
2309 final int? vf64Offset = _vf64 == null ? null
2310 : fbBuilder.writeListFloat64(_vf64!);
2311 fbBuilder.startTable(12);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002312 fbBuilder.addInt8(0, _i8);
2313 fbBuilder.addUint8(1, _u8);
2314 fbBuilder.addInt16(2, _i16);
2315 fbBuilder.addUint16(3, _u16);
2316 fbBuilder.addInt32(4, _i32);
2317 fbBuilder.addUint32(5, _u32);
2318 fbBuilder.addInt64(6, _i64);
2319 fbBuilder.addUint64(7, _u64);
2320 fbBuilder.addFloat32(8, _f32);
2321 fbBuilder.addFloat64(9, _f64);
James Kuszmaul8e62b022022-03-22 09:33:25 -07002322 fbBuilder.addOffset(10, v8Offset);
2323 fbBuilder.addOffset(11, vf64Offset);
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002324 return fbBuilder.endTable();
2325 }
2326
2327 /// Convenience method to serialize to byte list.
2328 @override
James Kuszmaul8e62b022022-03-22 09:33:25 -07002329 Uint8List toBytes([String? fileIdentifier]) {
2330 final fbBuilder = fb.Builder(deduplicateTables: false);
2331 fbBuilder.finish(finish(fbBuilder), fileIdentifier);
2332 return fbBuilder.buffer;
Austin Schuhe89fa2d2019-08-14 20:24:23 -07002333 }
2334}