1// automatically generated by the FlatBuffers compiler, do not modify 2// ignore_for_file: unused_import, unused_field, unused_local_variable 3 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) { 18 if (value == null) value = 0; 19 if (!values.containsKey(value)) { 20 throw new StateError('Invalid value $value for bit flag enum Color'); 21 } 22 return values[value]; 23 } 24 25 static bool containsValue(int value) => values.containsKey(value); 26 27 static const Color Red = const Color._(1); 28 29 /// \brief color Green 30 /// Green is bit_flag with value (1u << 1) 31 static const Color Green = const Color._(2); 32 33 /// \brief color Blue (1u << 3) 34 static const Color Blue = const Color._(8); 35 static const Map<int,Color> values = {1: Red,2: Green,8: Blue,}; 36 37 static const fb.Reader<Color> reader = const _ColorReader(); 38 39 @override 40 String toString() { 41 return 'Color{value: $value}'; 42 } 43} 44 45class _ColorReader extends fb.Reader<Color> { 46 const _ColorReader(); 47 48 @override 49 int get size => 1; 50 51 @override 52 Color read(fb.BufferContext bc, int offset) => 53 new Color.fromValue(const fb.Uint8Reader().read(bc, offset)); 54} 55 56class Race { 57 final int value; 58 const Race._(this.value); 59 60 factory Race.fromValue(int value) { 61 if (value == null) value = 0; 62 if (!values.containsKey(value)) { 63 throw new StateError('Invalid value $value for bit flag enum Race'); 64 } 65 return values[value]; 66 } 67 68 static const int minValue = -1; 69 static const int maxValue = 2; 70 static bool containsValue(int value) => values.containsKey(value); 71 72 static const Race None = const Race._(-1); 73 static const Race Human = const Race._(0); 74 static const Race Dwarf = const Race._(1); 75 static const Race Elf = const Race._(2); 76 static const Map<int,Race> values = {-1: None,0: Human,1: Dwarf,2: Elf,}; 77 78 static const fb.Reader<Race> reader = const _RaceReader(); 79 80 @override 81 String toString() { 82 return 'Race{value: $value}'; 83 } 84} 85 86class _RaceReader extends fb.Reader<Race> { 87 const _RaceReader(); 88 89 @override 90 int get size => 1; 91 92 @override 93 Race read(fb.BufferContext bc, int offset) => 94 new Race.fromValue(const fb.Int8Reader().read(bc, offset)); 95} 96 97class AnyTypeId { 98 final int value; 99 const AnyTypeId._(this.value); 100 101 factory AnyTypeId.fromValue(int value) { 102 if (value == null) value = 0; 103 if (!values.containsKey(value)) { 104 throw new StateError('Invalid value $value for bit flag enum AnyTypeId'); 105 } 106 return values[value]; 107 } 108 109 static const int minValue = 0; 110 static const int maxValue = 3; 111 static bool containsValue(int value) => values.containsKey(value); 112 113 static const AnyTypeId NONE = const AnyTypeId._(0); 114 static const AnyTypeId Monster = const AnyTypeId._(1); 115 static const AnyTypeId TestSimpleTableWithEnum = const AnyTypeId._(2); 116 static const AnyTypeId MyGame_Example2_Monster = const AnyTypeId._(3); 117 static const Map<int,AnyTypeId> values = {0: NONE,1: Monster,2: TestSimpleTableWithEnum,3: MyGame_Example2_Monster,}; 118 119 static const fb.Reader<AnyTypeId> reader = const _AnyTypeIdReader(); 120 121 @override 122 String toString() { 123 return 'AnyTypeId{value: $value}'; 124 } 125} 126 127class _AnyTypeIdReader extends fb.Reader<AnyTypeId> { 128 const _AnyTypeIdReader(); 129 130 @override 131 int get size => 1; 132 133 @override 134 AnyTypeId read(fb.BufferContext bc, int offset) => 135 new AnyTypeId.fromValue(const fb.Uint8Reader().read(bc, offset)); 136} 137 138class AnyUniqueAliasesTypeId { 139 final int value; 140 const AnyUniqueAliasesTypeId._(this.value); 141 142 factory AnyUniqueAliasesTypeId.fromValue(int value) { 143 if (value == null) value = 0; 144 if (!values.containsKey(value)) { 145 throw new StateError('Invalid value $value for bit flag enum AnyUniqueAliasesTypeId'); 146 } 147 return values[value]; 148 } 149 150 static const int minValue = 0; 151 static const int maxValue = 3; 152 static bool containsValue(int value) => values.containsKey(value); 153 154 static const AnyUniqueAliasesTypeId NONE = const AnyUniqueAliasesTypeId._(0); 155 static const AnyUniqueAliasesTypeId M = const AnyUniqueAliasesTypeId._(1); 156 static const AnyUniqueAliasesTypeId TS = const AnyUniqueAliasesTypeId._(2); 157 static const AnyUniqueAliasesTypeId M2 = const AnyUniqueAliasesTypeId._(3); 158 static const Map<int,AnyUniqueAliasesTypeId> values = {0: NONE,1: M,2: TS,3: M2,}; 159 160 static const fb.Reader<AnyUniqueAliasesTypeId> reader = const _AnyUniqueAliasesTypeIdReader(); 161 162 @override 163 String toString() { 164 return 'AnyUniqueAliasesTypeId{value: $value}'; 165 } 166} 167 168class _AnyUniqueAliasesTypeIdReader extends fb.Reader<AnyUniqueAliasesTypeId> { 169 const _AnyUniqueAliasesTypeIdReader(); 170 171 @override 172 int get size => 1; 173 174 @override 175 AnyUniqueAliasesTypeId read(fb.BufferContext bc, int offset) => 176 new AnyUniqueAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset)); 177} 178 179class AnyAmbiguousAliasesTypeId { 180 final int value; 181 const AnyAmbiguousAliasesTypeId._(this.value); 182 183 factory AnyAmbiguousAliasesTypeId.fromValue(int value) { 184 if (value == null) value = 0; 185 if (!values.containsKey(value)) { 186 throw new StateError('Invalid value $value for bit flag enum AnyAmbiguousAliasesTypeId'); 187 } 188 return values[value]; 189 } 190 191 static const int minValue = 0; 192 static const int maxValue = 3; 193 static bool containsValue(int value) => values.containsKey(value); 194 195 static const AnyAmbiguousAliasesTypeId NONE = const AnyAmbiguousAliasesTypeId._(0); 196 static const AnyAmbiguousAliasesTypeId M1 = const AnyAmbiguousAliasesTypeId._(1); 197 static const AnyAmbiguousAliasesTypeId M2 = const AnyAmbiguousAliasesTypeId._(2); 198 static const AnyAmbiguousAliasesTypeId M3 = const AnyAmbiguousAliasesTypeId._(3); 199 static const Map<int,AnyAmbiguousAliasesTypeId> values = {0: NONE,1: M1,2: M2,3: M3,}; 200 201 static const fb.Reader<AnyAmbiguousAliasesTypeId> reader = const _AnyAmbiguousAliasesTypeIdReader(); 202 203 @override 204 String toString() { 205 return 'AnyAmbiguousAliasesTypeId{value: $value}'; 206 } 207} 208 209class _AnyAmbiguousAliasesTypeIdReader extends fb.Reader<AnyAmbiguousAliasesTypeId> { 210 const _AnyAmbiguousAliasesTypeIdReader(); 211 212 @override 213 int get size => 1; 214 215 @override 216 AnyAmbiguousAliasesTypeId read(fb.BufferContext bc, int offset) => 217 new AnyAmbiguousAliasesTypeId.fromValue(const fb.Uint8Reader().read(bc, offset)); 218} 219 220class Test { 221 Test._(this._bc, this._bcOffset); 222 223 static const fb.Reader<Test> reader = const _TestReader(); 224 225 final fb.BufferContext _bc; 226 final int _bcOffset; 227 228 int get a => const fb.Int16Reader().read(_bc, _bcOffset + 0); 229 int get b => const fb.Int8Reader().read(_bc, _bcOffset + 2); 230 231 @override 232 String toString() { 233 return 'Test{a: $a, b: $b}'; 234 } 235} 236 237class _TestReader extends fb.StructReader<Test> { 238 const _TestReader(); 239 240 @override 241 int get size => 4; 242 243 @override 244 Test createObject(fb.BufferContext bc, int offset) => 245 new Test._(bc, offset); 246} 247 248class TestBuilder { 249 TestBuilder(this.fbBuilder) { 250 assert(fbBuilder != null); 251 } 252 253 final fb.Builder fbBuilder; 254 255 int finish(int a, int b) { 256 fbBuilder.pad(1); 257 fbBuilder.putInt8(b); 258 fbBuilder.putInt16(a); 259 return fbBuilder.offset; 260 } 261 262} 263 264class TestObjectBuilder extends fb.ObjectBuilder { 265 final int _a; 266 final int _b; 267 268 TestObjectBuilder({ 269 int a, 270 int b, 271 }) 272 : _a = a, 273 _b = b; 274 275 /// Finish building, and store into the [fbBuilder]. 276 @override 277 int finish( 278 fb.Builder fbBuilder) { 279 assert(fbBuilder != null); 280 281 fbBuilder.pad(1); 282 fbBuilder.putInt8(_b); 283 fbBuilder.putInt16(_a); 284 return fbBuilder.offset; 285 } 286 287 /// Convenience method to serialize to byte list. 288 @override 289 Uint8List toBytes([String fileIdentifier]) { 290 fb.Builder fbBuilder = new fb.Builder(); 291 int offset = finish(fbBuilder); 292 return fbBuilder.finish(offset, fileIdentifier); 293 } 294} 295class TestSimpleTableWithEnum { 296 TestSimpleTableWithEnum._(this._bc, this._bcOffset); 297 factory TestSimpleTableWithEnum(List<int> bytes) { 298 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes); 299 return reader.read(rootRef, 0); 300 } 301 302 static const fb.Reader<TestSimpleTableWithEnum> reader = const _TestSimpleTableWithEnumReader(); 303 304 final fb.BufferContext _bc; 305 final int _bcOffset; 306 307 Color get color => new Color.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 4, 2)); 308 309 @override 310 String toString() { 311 return 'TestSimpleTableWithEnum{color: $color}'; 312 } 313} 314 315class _TestSimpleTableWithEnumReader extends fb.TableReader<TestSimpleTableWithEnum> { 316 const _TestSimpleTableWithEnumReader(); 317 318 @override 319 TestSimpleTableWithEnum createObject(fb.BufferContext bc, int offset) => 320 new TestSimpleTableWithEnum._(bc, offset); 321} 322 323class TestSimpleTableWithEnumBuilder { 324 TestSimpleTableWithEnumBuilder(this.fbBuilder) { 325 assert(fbBuilder != null); 326 } 327 328 final fb.Builder fbBuilder; 329 330 void begin() { 331 fbBuilder.startTable(); 332 } 333 334 int addColor(Color color) { 335 fbBuilder.addUint8(0, color?.value); 336 return fbBuilder.offset; 337 } 338 339 int finish() { 340 return fbBuilder.endTable(); 341 } 342} 343 344class TestSimpleTableWithEnumObjectBuilder extends fb.ObjectBuilder { 345 final Color _color; 346 347 TestSimpleTableWithEnumObjectBuilder({ 348 Color color, 349 }) 350 : _color = color; 351 352 /// Finish building, and store into the [fbBuilder]. 353 @override 354 int finish( 355 fb.Builder fbBuilder) { 356 assert(fbBuilder != null); 357 358 fbBuilder.startTable(); 359 fbBuilder.addUint8(0, _color?.value); 360 return fbBuilder.endTable(); 361 } 362 363 /// Convenience method to serialize to byte list. 364 @override 365 Uint8List toBytes([String fileIdentifier]) { 366 fb.Builder fbBuilder = new fb.Builder(); 367 int offset = finish(fbBuilder); 368 return fbBuilder.finish(offset, fileIdentifier); 369 } 370} 371class Vec3 { 372 Vec3._(this._bc, this._bcOffset); 373 374 static const fb.Reader<Vec3> reader = const _Vec3Reader(); 375 376 final fb.BufferContext _bc; 377 final int _bcOffset; 378 379 double get x => const fb.Float32Reader().read(_bc, _bcOffset + 0); 380 double get y => const fb.Float32Reader().read(_bc, _bcOffset + 4); 381 double get z => const fb.Float32Reader().read(_bc, _bcOffset + 8); 382 double get test1 => const fb.Float64Reader().read(_bc, _bcOffset + 16); 383 Color get test2 => new Color.fromValue(const fb.Uint8Reader().read(_bc, _bcOffset + 24)); 384 Test get test3 => Test.reader.read(_bc, _bcOffset + 26); 385 386 @override 387 String toString() { 388 return 'Vec3{x: $x, y: $y, z: $z, test1: $test1, test2: $test2, test3: $test3}'; 389 } 390} 391 392class _Vec3Reader extends fb.StructReader<Vec3> { 393 const _Vec3Reader(); 394 395 @override 396 int get size => 32; 397 398 @override 399 Vec3 createObject(fb.BufferContext bc, int offset) => 400 new Vec3._(bc, offset); 401} 402 403class Vec3Builder { 404 Vec3Builder(this.fbBuilder) { 405 assert(fbBuilder != null); 406 } 407 408 final fb.Builder fbBuilder; 409 410 int finish(double x, double y, double z, double test1, Color test2, fb.StructBuilder test3) { 411 fbBuilder.pad(2); 412 test3(); 413 fbBuilder.pad(1); 414 fbBuilder.putUint8(test2?.value); 415 fbBuilder.putFloat64(test1); 416 fbBuilder.pad(4); 417 fbBuilder.putFloat32(z); 418 fbBuilder.putFloat32(y); 419 fbBuilder.putFloat32(x); 420 return fbBuilder.offset; 421 } 422 423} 424 425class Vec3ObjectBuilder extends fb.ObjectBuilder { 426 final double _x; 427 final double _y; 428 final double _z; 429 final double _test1; 430 final Color _test2; 431 final TestObjectBuilder _test3; 432 433 Vec3ObjectBuilder({ 434 double x, 435 double y, 436 double z, 437 double test1, 438 Color test2, 439 TestObjectBuilder test3, 440 }) 441 : _x = x, 442 _y = y, 443 _z = z, 444 _test1 = test1, 445 _test2 = test2, 446 _test3 = test3; 447 448 /// Finish building, and store into the [fbBuilder]. 449 @override 450 int finish( 451 fb.Builder fbBuilder) { 452 assert(fbBuilder != null); 453 454 fbBuilder.pad(2); 455 _test3.finish(fbBuilder); 456 fbBuilder.pad(1); 457 fbBuilder.putUint8(_test2?.value); 458 fbBuilder.putFloat64(_test1); 459 fbBuilder.pad(4); 460 fbBuilder.putFloat32(_z); 461 fbBuilder.putFloat32(_y); 462 fbBuilder.putFloat32(_x); 463 return fbBuilder.offset; 464 } 465 466 /// Convenience method to serialize to byte list. 467 @override 468 Uint8List toBytes([String fileIdentifier]) { 469 fb.Builder fbBuilder = new fb.Builder(); 470 int offset = finish(fbBuilder); 471 return fbBuilder.finish(offset, fileIdentifier); 472 } 473} 474class Ability { 475 Ability._(this._bc, this._bcOffset); 476 477 static const fb.Reader<Ability> reader = const _AbilityReader(); 478 479 final fb.BufferContext _bc; 480 final int _bcOffset; 481 482 int get id => const fb.Uint32Reader().read(_bc, _bcOffset + 0); 483 int get distance => const fb.Uint32Reader().read(_bc, _bcOffset + 4); 484 485 @override 486 String toString() { 487 return 'Ability{id: $id, distance: $distance}'; 488 } 489} 490 491class _AbilityReader extends fb.StructReader<Ability> { 492 const _AbilityReader(); 493 494 @override 495 int get size => 8; 496 497 @override 498 Ability createObject(fb.BufferContext bc, int offset) => 499 new Ability._(bc, offset); 500} 501 502class AbilityBuilder { 503 AbilityBuilder(this.fbBuilder) { 504 assert(fbBuilder != null); 505 } 506 507 final fb.Builder fbBuilder; 508 509 int finish(int id, int distance) { 510 fbBuilder.putUint32(distance); 511 fbBuilder.putUint32(id); 512 return fbBuilder.offset; 513 } 514 515} 516 517class AbilityObjectBuilder extends fb.ObjectBuilder { 518 final int _id; 519 final int _distance; 520 521 AbilityObjectBuilder({ 522 int id, 523 int distance, 524 }) 525 : _id = id, 526 _distance = distance; 527 528 /// Finish building, and store into the [fbBuilder]. 529 @override 530 int finish( 531 fb.Builder fbBuilder) { 532 assert(fbBuilder != null); 533 534 fbBuilder.putUint32(_distance); 535 fbBuilder.putUint32(_id); 536 return fbBuilder.offset; 537 } 538 539 /// Convenience method to serialize to byte list. 540 @override 541 Uint8List toBytes([String fileIdentifier]) { 542 fb.Builder fbBuilder = new fb.Builder(); 543 int offset = finish(fbBuilder); 544 return fbBuilder.finish(offset, fileIdentifier); 545 } 546} 547class StructOfStructs { 548 StructOfStructs._(this._bc, this._bcOffset); 549 550 static const fb.Reader<StructOfStructs> reader = const _StructOfStructsReader(); 551 552 final fb.BufferContext _bc; 553 final int _bcOffset; 554 555 Ability get a => Ability.reader.read(_bc, _bcOffset + 0); 556 Test get b => Test.reader.read(_bc, _bcOffset + 8); 557 Ability get c => Ability.reader.read(_bc, _bcOffset + 12); 558 559 @override 560 String toString() { 561 return 'StructOfStructs{a: $a, b: $b, c: $c}'; 562 } 563} 564 565class _StructOfStructsReader extends fb.StructReader<StructOfStructs> { 566 const _StructOfStructsReader(); 567 568 @override 569 int get size => 20; 570 571 @override 572 StructOfStructs createObject(fb.BufferContext bc, int offset) => 573 new StructOfStructs._(bc, offset); 574} 575 576class StructOfStructsBuilder { 577 StructOfStructsBuilder(this.fbBuilder) { 578 assert(fbBuilder != null); 579 } 580 581 final fb.Builder fbBuilder; 582 583 int finish(fb.StructBuilder a, fb.StructBuilder b, fb.StructBuilder c) { 584 c(); 585 b(); 586 a(); 587 return fbBuilder.offset; 588 } 589 590} 591 592class StructOfStructsObjectBuilder extends fb.ObjectBuilder { 593 final AbilityObjectBuilder _a; 594 final TestObjectBuilder _b; 595 final AbilityObjectBuilder _c; 596 597 StructOfStructsObjectBuilder({ 598 AbilityObjectBuilder a, 599 TestObjectBuilder b, 600 AbilityObjectBuilder c, 601 }) 602 : _a = a, 603 _b = b, 604 _c = c; 605 606 /// Finish building, and store into the [fbBuilder]. 607 @override 608 int finish( 609 fb.Builder fbBuilder) { 610 assert(fbBuilder != null); 611 612 _c.finish(fbBuilder); 613 _b.finish(fbBuilder); 614 _a.finish(fbBuilder); 615 return fbBuilder.offset; 616 } 617 618 /// Convenience method to serialize to byte list. 619 @override 620 Uint8List toBytes([String fileIdentifier]) { 621 fb.Builder fbBuilder = new fb.Builder(); 622 int offset = finish(fbBuilder); 623 return fbBuilder.finish(offset, fileIdentifier); 624 } 625} 626class Stat { 627 Stat._(this._bc, this._bcOffset); 628 factory Stat(List<int> bytes) { 629 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes); 630 return reader.read(rootRef, 0); 631 } 632 633 static const fb.Reader<Stat> reader = const _StatReader(); 634 635 final fb.BufferContext _bc; 636 final int _bcOffset; 637 638 String get id => const fb.StringReader().vTableGet(_bc, _bcOffset, 4, null); 639 int get val => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 6, 0); 640 int get count => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 8, 0); 641 642 @override 643 String toString() { 644 return 'Stat{id: $id, val: $val, count: $count}'; 645 } 646} 647 648class _StatReader extends fb.TableReader<Stat> { 649 const _StatReader(); 650 651 @override 652 Stat createObject(fb.BufferContext bc, int offset) => 653 new Stat._(bc, offset); 654} 655 656class StatBuilder { 657 StatBuilder(this.fbBuilder) { 658 assert(fbBuilder != null); 659 } 660 661 final fb.Builder fbBuilder; 662 663 void begin() { 664 fbBuilder.startTable(); 665 } 666 667 int addIdOffset(int offset) { 668 fbBuilder.addOffset(0, offset); 669 return fbBuilder.offset; 670 } 671 int addVal(int val) { 672 fbBuilder.addInt64(1, val); 673 return fbBuilder.offset; 674 } 675 int addCount(int count) { 676 fbBuilder.addUint16(2, count); 677 return fbBuilder.offset; 678 } 679 680 int finish() { 681 return fbBuilder.endTable(); 682 } 683} 684 685class StatObjectBuilder extends fb.ObjectBuilder { 686 final String _id; 687 final int _val; 688 final int _count; 689 690 StatObjectBuilder({ 691 String id, 692 int val, 693 int count, 694 }) 695 : _id = id, 696 _val = val, 697 _count = count; 698 699 /// Finish building, and store into the [fbBuilder]. 700 @override 701 int finish( 702 fb.Builder fbBuilder) { 703 assert(fbBuilder != null); 704 final int idOffset = fbBuilder.writeString(_id); 705 706 fbBuilder.startTable(); 707 if (idOffset != null) { 708 fbBuilder.addOffset(0, idOffset); 709 } 710 fbBuilder.addInt64(1, _val); 711 fbBuilder.addUint16(2, _count); 712 return fbBuilder.endTable(); 713 } 714 715 /// Convenience method to serialize to byte list. 716 @override 717 Uint8List toBytes([String fileIdentifier]) { 718 fb.Builder fbBuilder = new fb.Builder(); 719 int offset = finish(fbBuilder); 720 return fbBuilder.finish(offset, fileIdentifier); 721 } 722} 723class Referrable { 724 Referrable._(this._bc, this._bcOffset); 725 factory Referrable(List<int> bytes) { 726 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes); 727 return reader.read(rootRef, 0); 728 } 729 730 static const fb.Reader<Referrable> reader = const _ReferrableReader(); 731 732 final fb.BufferContext _bc; 733 final int _bcOffset; 734 735 int get id => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 4, 0); 736 737 @override 738 String toString() { 739 return 'Referrable{id: $id}'; 740 } 741} 742 743class _ReferrableReader extends fb.TableReader<Referrable> { 744 const _ReferrableReader(); 745 746 @override 747 Referrable createObject(fb.BufferContext bc, int offset) => 748 new Referrable._(bc, offset); 749} 750 751class ReferrableBuilder { 752 ReferrableBuilder(this.fbBuilder) { 753 assert(fbBuilder != null); 754 } 755 756 final fb.Builder fbBuilder; 757 758 void begin() { 759 fbBuilder.startTable(); 760 } 761 762 int addId(int id) { 763 fbBuilder.addUint64(0, id); 764 return fbBuilder.offset; 765 } 766 767 int finish() { 768 return fbBuilder.endTable(); 769 } 770} 771 772class ReferrableObjectBuilder extends fb.ObjectBuilder { 773 final int _id; 774 775 ReferrableObjectBuilder({ 776 int id, 777 }) 778 : _id = id; 779 780 /// Finish building, and store into the [fbBuilder]. 781 @override 782 int finish( 783 fb.Builder fbBuilder) { 784 assert(fbBuilder != null); 785 786 fbBuilder.startTable(); 787 fbBuilder.addUint64(0, _id); 788 return fbBuilder.endTable(); 789 } 790 791 /// Convenience method to serialize to byte list. 792 @override 793 Uint8List toBytes([String fileIdentifier]) { 794 fb.Builder fbBuilder = new fb.Builder(); 795 int offset = finish(fbBuilder); 796 return fbBuilder.finish(offset, fileIdentifier); 797 } 798} 799/// an example documentation comment: "monster object" 800class Monster { 801 Monster._(this._bc, this._bcOffset); 802 factory Monster(List<int> bytes) { 803 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes); 804 return reader.read(rootRef, 0); 805 } 806 807 static const fb.Reader<Monster> reader = const _MonsterReader(); 808 809 final fb.BufferContext _bc; 810 final int _bcOffset; 811 812 Vec3 get pos => Vec3.reader.vTableGet(_bc, _bcOffset, 4, null); 813 int get mana => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 6, 150); 814 int get hp => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 8, 100); 815 String get name => const fb.StringReader().vTableGet(_bc, _bcOffset, 10, null); 816 List<int> get inventory => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 14, null); 817 Color get color => new Color.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 16, 8)); 818 AnyTypeId get testType => new AnyTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 18, 0)); 819 dynamic get test { 820 switch (testType?.value) { 821 case 1: return Monster.reader.vTableGet(_bc, _bcOffset, 20, null); 822 case 2: return TestSimpleTableWithEnum.reader.vTableGet(_bc, _bcOffset, 20, null); 823 case 3: return my_game_example2.Monster.reader.vTableGet(_bc, _bcOffset, 20, null); 824 default: return null; 825 } 826 } 827 List<Test> get test4 => const fb.ListReader<Test>(Test.reader).vTableGet(_bc, _bcOffset, 22, null); 828 List<String> get testarrayofstring => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 24, null); 829 /// an example documentation comment: this will end up in the generated code 830 /// multiline too 831 List<Monster> get testarrayoftables => const fb.ListReader<Monster>(Monster.reader).vTableGet(_bc, _bcOffset, 26, null); 832 Monster get enemy => Monster.reader.vTableGet(_bc, _bcOffset, 28, null); 833 List<int> get testnestedflatbuffer => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 30, null); 834 Stat get testempty => Stat.reader.vTableGet(_bc, _bcOffset, 32, null); 835 bool get testbool => const fb.BoolReader().vTableGet(_bc, _bcOffset, 34, false); 836 int get testhashs32Fnv1 => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 36, 0); 837 int get testhashu32Fnv1 => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 38, 0); 838 int get testhashs64Fnv1 => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 40, 0); 839 int get testhashu64Fnv1 => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 42, 0); 840 int get testhashs32Fnv1a => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 44, 0); 841 int get testhashu32Fnv1a => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 46, 0); 842 int get testhashs64Fnv1a => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 48, 0); 843 int get testhashu64Fnv1a => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 50, 0); 844 List<bool> get testarrayofbools => const fb.ListReader<bool>(const fb.BoolReader()).vTableGet(_bc, _bcOffset, 52, null); 845 double get testf => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 54, 3.14159); 846 double get testf2 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 56, 3.0); 847 double get testf3 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 58, 0.0); 848 List<String> get testarrayofstring2 => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 60, null); 849 List<Ability> get testarrayofsortedstruct => const fb.ListReader<Ability>(Ability.reader).vTableGet(_bc, _bcOffset, 62, null); 850 List<int> get flex => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 64, null); 851 List<Test> get test5 => const fb.ListReader<Test>(Test.reader).vTableGet(_bc, _bcOffset, 66, null); 852 List<int> get vectorOfLongs => const fb.ListReader<int>(const fb.Int64Reader()).vTableGet(_bc, _bcOffset, 68, null); 853 List<double> get vectorOfDoubles => const fb.ListReader<double>(const fb.Float64Reader()).vTableGet(_bc, _bcOffset, 70, null); 854 my_game.InParentNamespace get parentNamespaceTest => my_game.InParentNamespace.reader.vTableGet(_bc, _bcOffset, 72, null); 855 List<Referrable> get vectorOfReferrables => const fb.ListReader<Referrable>(Referrable.reader).vTableGet(_bc, _bcOffset, 74, null); 856 int get singleWeakReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 76, 0); 857 List<int> get vectorOfWeakReferences => const fb.ListReader<int>(const fb.Uint64Reader()).vTableGet(_bc, _bcOffset, 78, null); 858 List<Referrable> get vectorOfStrongReferrables => const fb.ListReader<Referrable>(Referrable.reader).vTableGet(_bc, _bcOffset, 80, null); 859 int get coOwningReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 82, 0); 860 List<int> get vectorOfCoOwningReferences => const fb.ListReader<int>(const fb.Uint64Reader()).vTableGet(_bc, _bcOffset, 84, null); 861 int get nonOwningReference => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 86, 0); 862 List<int> get vectorOfNonOwningReferences => const fb.ListReader<int>(const fb.Uint64Reader()).vTableGet(_bc, _bcOffset, 88, null); 863 AnyUniqueAliasesTypeId get anyUniqueType => new AnyUniqueAliasesTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 90, 0)); 864 dynamic get anyUnique { 865 switch (anyUniqueType?.value) { 866 case 1: return Monster.reader.vTableGet(_bc, _bcOffset, 92, null); 867 case 2: return TestSimpleTableWithEnum.reader.vTableGet(_bc, _bcOffset, 92, null); 868 case 3: return my_game_example2.Monster.reader.vTableGet(_bc, _bcOffset, 92, null); 869 default: return null; 870 } 871 } 872 AnyAmbiguousAliasesTypeId get anyAmbiguousType => new AnyAmbiguousAliasesTypeId.fromValue(const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 94, 0)); 873 dynamic get anyAmbiguous { 874 switch (anyAmbiguousType?.value) { 875 case 1: return Monster.reader.vTableGet(_bc, _bcOffset, 96, null); 876 case 2: return Monster.reader.vTableGet(_bc, _bcOffset, 96, null); 877 case 3: return Monster.reader.vTableGet(_bc, _bcOffset, 96, null); 878 default: return null; 879 } 880 } 881 List<Color> get vectorOfEnums => const fb.ListReader<Color>(Color.reader).vTableGet(_bc, _bcOffset, 98, null); 882 Race get signedEnum => new Race.fromValue(const fb.Int8Reader().vTableGet(_bc, _bcOffset, 100, -1)); 883 List<int> get testrequirednestedflatbuffer => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 102, null); 884 List<Stat> get scalarKeySortedTables => const fb.ListReader<Stat>(Stat.reader).vTableGet(_bc, _bcOffset, 104, null); 885 886 @override 887 String toString() { 888 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}'; 889 } 890} 891 892class _MonsterReader extends fb.TableReader<Monster> { 893 const _MonsterReader(); 894 895 @override 896 Monster createObject(fb.BufferContext bc, int offset) => 897 new Monster._(bc, offset); 898} 899 900class MonsterBuilder { 901 MonsterBuilder(this.fbBuilder) { 902 assert(fbBuilder != null); 903 } 904 905 final fb.Builder fbBuilder; 906 907 void begin() { 908 fbBuilder.startTable(); 909 } 910 911 int addPos(int offset) { 912 fbBuilder.addStruct(0, offset); 913 return fbBuilder.offset; 914 } 915 int addMana(int mana) { 916 fbBuilder.addInt16(1, mana); 917 return fbBuilder.offset; 918 } 919 int addHp(int hp) { 920 fbBuilder.addInt16(2, hp); 921 return fbBuilder.offset; 922 } 923 int addNameOffset(int offset) { 924 fbBuilder.addOffset(3, offset); 925 return fbBuilder.offset; 926 } 927 int addInventoryOffset(int offset) { 928 fbBuilder.addOffset(5, offset); 929 return fbBuilder.offset; 930 } 931 int addColor(Color color) { 932 fbBuilder.addUint8(6, color?.value); 933 return fbBuilder.offset; 934 } 935 int addTestType(AnyTypeId testType) { 936 fbBuilder.addUint8(7, testType?.value); 937 return fbBuilder.offset; 938 } 939 int addTestOffset(int offset) { 940 fbBuilder.addOffset(8, offset); 941 return fbBuilder.offset; 942 } 943 int addTest4Offset(int offset) { 944 fbBuilder.addOffset(9, offset); 945 return fbBuilder.offset; 946 } 947 int addTestarrayofstringOffset(int offset) { 948 fbBuilder.addOffset(10, offset); 949 return fbBuilder.offset; 950 } 951 int addTestarrayoftablesOffset(int offset) { 952 fbBuilder.addOffset(11, offset); 953 return fbBuilder.offset; 954 } 955 int addEnemyOffset(int offset) { 956 fbBuilder.addOffset(12, offset); 957 return fbBuilder.offset; 958 } 959 int addTestnestedflatbufferOffset(int offset) { 960 fbBuilder.addOffset(13, offset); 961 return fbBuilder.offset; 962 } 963 int addTestemptyOffset(int offset) { 964 fbBuilder.addOffset(14, offset); 965 return fbBuilder.offset; 966 } 967 int addTestbool(bool testbool) { 968 fbBuilder.addBool(15, testbool); 969 return fbBuilder.offset; 970 } 971 int addTesthashs32Fnv1(int testhashs32Fnv1) { 972 fbBuilder.addInt32(16, testhashs32Fnv1); 973 return fbBuilder.offset; 974 } 975 int addTesthashu32Fnv1(int testhashu32Fnv1) { 976 fbBuilder.addUint32(17, testhashu32Fnv1); 977 return fbBuilder.offset; 978 } 979 int addTesthashs64Fnv1(int testhashs64Fnv1) { 980 fbBuilder.addInt64(18, testhashs64Fnv1); 981 return fbBuilder.offset; 982 } 983 int addTesthashu64Fnv1(int testhashu64Fnv1) { 984 fbBuilder.addUint64(19, testhashu64Fnv1); 985 return fbBuilder.offset; 986 } 987 int addTesthashs32Fnv1a(int testhashs32Fnv1a) { 988 fbBuilder.addInt32(20, testhashs32Fnv1a); 989 return fbBuilder.offset; 990 } 991 int addTesthashu32Fnv1a(int testhashu32Fnv1a) { 992 fbBuilder.addUint32(21, testhashu32Fnv1a); 993 return fbBuilder.offset; 994 } 995 int addTesthashs64Fnv1a(int testhashs64Fnv1a) { 996 fbBuilder.addInt64(22, testhashs64Fnv1a); 997 return fbBuilder.offset; 998 } 999 int addTesthashu64Fnv1a(int testhashu64Fnv1a) { 1000 fbBuilder.addUint64(23, testhashu64Fnv1a); 1001 return fbBuilder.offset; 1002 } 1003 int addTestarrayofboolsOffset(int offset) { 1004 fbBuilder.addOffset(24, offset); 1005 return fbBuilder.offset; 1006 } 1007 int addTestf(double testf) { 1008 fbBuilder.addFloat32(25, testf); 1009 return fbBuilder.offset; 1010 } 1011 int addTestf2(double testf2) { 1012 fbBuilder.addFloat32(26, testf2); 1013 return fbBuilder.offset; 1014 } 1015 int addTestf3(double testf3) { 1016 fbBuilder.addFloat32(27, testf3); 1017 return fbBuilder.offset; 1018 } 1019 int addTestarrayofstring2Offset(int offset) { 1020 fbBuilder.addOffset(28, offset); 1021 return fbBuilder.offset; 1022 } 1023 int addTestarrayofsortedstructOffset(int offset) { 1024 fbBuilder.addOffset(29, offset); 1025 return fbBuilder.offset; 1026 } 1027 int addFlexOffset(int offset) { 1028 fbBuilder.addOffset(30, offset); 1029 return fbBuilder.offset; 1030 } 1031 int addTest5Offset(int offset) { 1032 fbBuilder.addOffset(31, offset); 1033 return fbBuilder.offset; 1034 } 1035 int addVectorOfLongsOffset(int offset) { 1036 fbBuilder.addOffset(32, offset); 1037 return fbBuilder.offset; 1038 } 1039 int addVectorOfDoublesOffset(int offset) { 1040 fbBuilder.addOffset(33, offset); 1041 return fbBuilder.offset; 1042 } 1043 int addParentNamespaceTestOffset(int offset) { 1044 fbBuilder.addOffset(34, offset); 1045 return fbBuilder.offset; 1046 } 1047 int addVectorOfReferrablesOffset(int offset) { 1048 fbBuilder.addOffset(35, offset); 1049 return fbBuilder.offset; 1050 } 1051 int addSingleWeakReference(int singleWeakReference) { 1052 fbBuilder.addUint64(36, singleWeakReference); 1053 return fbBuilder.offset; 1054 } 1055 int addVectorOfWeakReferencesOffset(int offset) { 1056 fbBuilder.addOffset(37, offset); 1057 return fbBuilder.offset; 1058 } 1059 int addVectorOfStrongReferrablesOffset(int offset) { 1060 fbBuilder.addOffset(38, offset); 1061 return fbBuilder.offset; 1062 } 1063 int addCoOwningReference(int coOwningReference) { 1064 fbBuilder.addUint64(39, coOwningReference); 1065 return fbBuilder.offset; 1066 } 1067 int addVectorOfCoOwningReferencesOffset(int offset) { 1068 fbBuilder.addOffset(40, offset); 1069 return fbBuilder.offset; 1070 } 1071 int addNonOwningReference(int nonOwningReference) { 1072 fbBuilder.addUint64(41, nonOwningReference); 1073 return fbBuilder.offset; 1074 } 1075 int addVectorOfNonOwningReferencesOffset(int offset) { 1076 fbBuilder.addOffset(42, offset); 1077 return fbBuilder.offset; 1078 } 1079 int addAnyUniqueType(AnyUniqueAliasesTypeId anyUniqueType) { 1080 fbBuilder.addUint8(43, anyUniqueType?.value); 1081 return fbBuilder.offset; 1082 } 1083 int addAnyUniqueOffset(int offset) { 1084 fbBuilder.addOffset(44, offset); 1085 return fbBuilder.offset; 1086 } 1087 int addAnyAmbiguousType(AnyAmbiguousAliasesTypeId anyAmbiguousType) { 1088 fbBuilder.addUint8(45, anyAmbiguousType?.value); 1089 return fbBuilder.offset; 1090 } 1091 int addAnyAmbiguousOffset(int offset) { 1092 fbBuilder.addOffset(46, offset); 1093 return fbBuilder.offset; 1094 } 1095 int addVectorOfEnumsOffset(int offset) { 1096 fbBuilder.addOffset(47, offset); 1097 return fbBuilder.offset; 1098 } 1099 int addSignedEnum(Race signedEnum) { 1100 fbBuilder.addInt8(48, signedEnum?.value); 1101 return fbBuilder.offset; 1102 } 1103 int addTestrequirednestedflatbufferOffset(int offset) { 1104 fbBuilder.addOffset(49, offset); 1105 return fbBuilder.offset; 1106 } 1107 int addScalarKeySortedTablesOffset(int offset) { 1108 fbBuilder.addOffset(50, offset); 1109 return fbBuilder.offset; 1110 } 1111 1112 int finish() { 1113 return fbBuilder.endTable(); 1114 } 1115} 1116 1117class MonsterObjectBuilder extends fb.ObjectBuilder { 1118 final Vec3ObjectBuilder _pos; 1119 final int _mana; 1120 final int _hp; 1121 final String _name; 1122 final List<int> _inventory; 1123 final Color _color; 1124 final AnyTypeId _testType; 1125 final dynamic _test; 1126 final List<TestObjectBuilder> _test4; 1127 final List<String> _testarrayofstring; 1128 final List<MonsterObjectBuilder> _testarrayoftables; 1129 final MonsterObjectBuilder _enemy; 1130 final List<int> _testnestedflatbuffer; 1131 final StatObjectBuilder _testempty; 1132 final bool _testbool; 1133 final int _testhashs32Fnv1; 1134 final int _testhashu32Fnv1; 1135 final int _testhashs64Fnv1; 1136 final int _testhashu64Fnv1; 1137 final int _testhashs32Fnv1a; 1138 final int _testhashu32Fnv1a; 1139 final int _testhashs64Fnv1a; 1140 final int _testhashu64Fnv1a; 1141 final List<bool> _testarrayofbools; 1142 final double _testf; 1143 final double _testf2; 1144 final double _testf3; 1145 final List<String> _testarrayofstring2; 1146 final List<AbilityObjectBuilder> _testarrayofsortedstruct; 1147 final List<int> _flex; 1148 final List<TestObjectBuilder> _test5; 1149 final List<int> _vectorOfLongs; 1150 final List<double> _vectorOfDoubles; 1151 final my_game.InParentNamespaceObjectBuilder _parentNamespaceTest; 1152 final List<ReferrableObjectBuilder> _vectorOfReferrables; 1153 final int _singleWeakReference; 1154 final List<int> _vectorOfWeakReferences; 1155 final List<ReferrableObjectBuilder> _vectorOfStrongReferrables; 1156 final int _coOwningReference; 1157 final List<int> _vectorOfCoOwningReferences; 1158 final int _nonOwningReference; 1159 final List<int> _vectorOfNonOwningReferences; 1160 final AnyUniqueAliasesTypeId _anyUniqueType; 1161 final dynamic _anyUnique; 1162 final AnyAmbiguousAliasesTypeId _anyAmbiguousType; 1163 final dynamic _anyAmbiguous; 1164 final List<Color> _vectorOfEnums; 1165 final Race _signedEnum; 1166 final List<int> _testrequirednestedflatbuffer; 1167 final List<StatObjectBuilder> _scalarKeySortedTables; 1168 1169 MonsterObjectBuilder({ 1170 Vec3ObjectBuilder pos, 1171 int mana, 1172 int hp, 1173 String name, 1174 List<int> inventory, 1175 Color color, 1176 AnyTypeId testType, 1177 dynamic test, 1178 List<TestObjectBuilder> test4, 1179 List<String> testarrayofstring, 1180 List<MonsterObjectBuilder> testarrayoftables, 1181 MonsterObjectBuilder enemy, 1182 List<int> testnestedflatbuffer, 1183 StatObjectBuilder testempty, 1184 bool testbool, 1185 int testhashs32Fnv1, 1186 int testhashu32Fnv1, 1187 int testhashs64Fnv1, 1188 int testhashu64Fnv1, 1189 int testhashs32Fnv1a, 1190 int testhashu32Fnv1a, 1191 int testhashs64Fnv1a, 1192 int testhashu64Fnv1a, 1193 List<bool> testarrayofbools, 1194 double testf, 1195 double testf2, 1196 double testf3, 1197 List<String> testarrayofstring2, 1198 List<AbilityObjectBuilder> testarrayofsortedstruct, 1199 List<int> flex, 1200 List<TestObjectBuilder> test5, 1201 List<int> vectorOfLongs, 1202 List<double> vectorOfDoubles, 1203 my_game.InParentNamespaceObjectBuilder parentNamespaceTest, 1204 List<ReferrableObjectBuilder> vectorOfReferrables, 1205 int singleWeakReference, 1206 List<int> vectorOfWeakReferences, 1207 List<ReferrableObjectBuilder> vectorOfStrongReferrables, 1208 int coOwningReference, 1209 List<int> vectorOfCoOwningReferences, 1210 int nonOwningReference, 1211 List<int> vectorOfNonOwningReferences, 1212 AnyUniqueAliasesTypeId anyUniqueType, 1213 dynamic anyUnique, 1214 AnyAmbiguousAliasesTypeId anyAmbiguousType, 1215 dynamic anyAmbiguous, 1216 List<Color> vectorOfEnums, 1217 Race signedEnum, 1218 List<int> testrequirednestedflatbuffer, 1219 List<StatObjectBuilder> scalarKeySortedTables, 1220 }) 1221 : _pos = pos, 1222 _mana = mana, 1223 _hp = hp, 1224 _name = name, 1225 _inventory = inventory, 1226 _color = color, 1227 _testType = testType, 1228 _test = test, 1229 _test4 = test4, 1230 _testarrayofstring = testarrayofstring, 1231 _testarrayoftables = testarrayoftables, 1232 _enemy = enemy, 1233 _testnestedflatbuffer = testnestedflatbuffer, 1234 _testempty = testempty, 1235 _testbool = testbool, 1236 _testhashs32Fnv1 = testhashs32Fnv1, 1237 _testhashu32Fnv1 = testhashu32Fnv1, 1238 _testhashs64Fnv1 = testhashs64Fnv1, 1239 _testhashu64Fnv1 = testhashu64Fnv1, 1240 _testhashs32Fnv1a = testhashs32Fnv1a, 1241 _testhashu32Fnv1a = testhashu32Fnv1a, 1242 _testhashs64Fnv1a = testhashs64Fnv1a, 1243 _testhashu64Fnv1a = testhashu64Fnv1a, 1244 _testarrayofbools = testarrayofbools, 1245 _testf = testf, 1246 _testf2 = testf2, 1247 _testf3 = testf3, 1248 _testarrayofstring2 = testarrayofstring2, 1249 _testarrayofsortedstruct = testarrayofsortedstruct, 1250 _flex = flex, 1251 _test5 = test5, 1252 _vectorOfLongs = vectorOfLongs, 1253 _vectorOfDoubles = vectorOfDoubles, 1254 _parentNamespaceTest = parentNamespaceTest, 1255 _vectorOfReferrables = vectorOfReferrables, 1256 _singleWeakReference = singleWeakReference, 1257 _vectorOfWeakReferences = vectorOfWeakReferences, 1258 _vectorOfStrongReferrables = vectorOfStrongReferrables, 1259 _coOwningReference = coOwningReference, 1260 _vectorOfCoOwningReferences = vectorOfCoOwningReferences, 1261 _nonOwningReference = nonOwningReference, 1262 _vectorOfNonOwningReferences = vectorOfNonOwningReferences, 1263 _anyUniqueType = anyUniqueType, 1264 _anyUnique = anyUnique, 1265 _anyAmbiguousType = anyAmbiguousType, 1266 _anyAmbiguous = anyAmbiguous, 1267 _vectorOfEnums = vectorOfEnums, 1268 _signedEnum = signedEnum, 1269 _testrequirednestedflatbuffer = testrequirednestedflatbuffer, 1270 _scalarKeySortedTables = scalarKeySortedTables; 1271 1272 /// Finish building, and store into the [fbBuilder]. 1273 @override 1274 int finish( 1275 fb.Builder fbBuilder) { 1276 assert(fbBuilder != null); 1277 final int nameOffset = fbBuilder.writeString(_name); 1278 final int inventoryOffset = _inventory?.isNotEmpty == true 1279 ? fbBuilder.writeListUint8(_inventory) 1280 : null; 1281 final int testOffset = _test?.getOrCreateOffset(fbBuilder); 1282 final int test4Offset = _test4?.isNotEmpty == true 1283 ? fbBuilder.writeListOfStructs(_test4) 1284 : null; 1285 final int testarrayofstringOffset = _testarrayofstring?.isNotEmpty == true 1286 ? fbBuilder.writeList(_testarrayofstring.map((b) => fbBuilder.writeString(b)).toList()) 1287 : null; 1288 final int testarrayoftablesOffset = _testarrayoftables?.isNotEmpty == true 1289 ? fbBuilder.writeList(_testarrayoftables.map((b) => b.getOrCreateOffset(fbBuilder)).toList()) 1290 : null; 1291 final int enemyOffset = _enemy?.getOrCreateOffset(fbBuilder); 1292 final int testnestedflatbufferOffset = _testnestedflatbuffer?.isNotEmpty == true 1293 ? fbBuilder.writeListUint8(_testnestedflatbuffer) 1294 : null; 1295 final int testemptyOffset = _testempty?.getOrCreateOffset(fbBuilder); 1296 final int testarrayofboolsOffset = _testarrayofbools?.isNotEmpty == true 1297 ? fbBuilder.writeListBool(_testarrayofbools) 1298 : null; 1299 final int testarrayofstring2Offset = _testarrayofstring2?.isNotEmpty == true 1300 ? fbBuilder.writeList(_testarrayofstring2.map((b) => fbBuilder.writeString(b)).toList()) 1301 : null; 1302 final int testarrayofsortedstructOffset = _testarrayofsortedstruct?.isNotEmpty == true 1303 ? fbBuilder.writeListOfStructs(_testarrayofsortedstruct) 1304 : null; 1305 final int flexOffset = _flex?.isNotEmpty == true 1306 ? fbBuilder.writeListUint8(_flex) 1307 : null; 1308 final int test5Offset = _test5?.isNotEmpty == true 1309 ? fbBuilder.writeListOfStructs(_test5) 1310 : null; 1311 final int vectorOfLongsOffset = _vectorOfLongs?.isNotEmpty == true 1312 ? fbBuilder.writeListInt64(_vectorOfLongs) 1313 : null; 1314 final int vectorOfDoublesOffset = _vectorOfDoubles?.isNotEmpty == true 1315 ? fbBuilder.writeListFloat64(_vectorOfDoubles) 1316 : null; 1317 final int parentNamespaceTestOffset = _parentNamespaceTest?.getOrCreateOffset(fbBuilder); 1318 final int vectorOfReferrablesOffset = _vectorOfReferrables?.isNotEmpty == true 1319 ? fbBuilder.writeList(_vectorOfReferrables.map((b) => b.getOrCreateOffset(fbBuilder)).toList()) 1320 : null; 1321 final int vectorOfWeakReferencesOffset = _vectorOfWeakReferences?.isNotEmpty == true 1322 ? fbBuilder.writeListUint64(_vectorOfWeakReferences) 1323 : null; 1324 final int vectorOfStrongReferrablesOffset = _vectorOfStrongReferrables?.isNotEmpty == true 1325 ? fbBuilder.writeList(_vectorOfStrongReferrables.map((b) => b.getOrCreateOffset(fbBuilder)).toList()) 1326 : null; 1327 final int vectorOfCoOwningReferencesOffset = _vectorOfCoOwningReferences?.isNotEmpty == true 1328 ? fbBuilder.writeListUint64(_vectorOfCoOwningReferences) 1329 : null; 1330 final int vectorOfNonOwningReferencesOffset = _vectorOfNonOwningReferences?.isNotEmpty == true 1331 ? fbBuilder.writeListUint64(_vectorOfNonOwningReferences) 1332 : null; 1333 final int anyUniqueOffset = _anyUnique?.getOrCreateOffset(fbBuilder); 1334 final int anyAmbiguousOffset = _anyAmbiguous?.getOrCreateOffset(fbBuilder); 1335 final int vectorOfEnumsOffset = _vectorOfEnums?.isNotEmpty == true 1336 ? fbBuilder.writeListUint8(_vectorOfEnums.map((f) => f.value)) 1337 : null; 1338 final int testrequirednestedflatbufferOffset = _testrequirednestedflatbuffer?.isNotEmpty == true 1339 ? fbBuilder.writeListUint8(_testrequirednestedflatbuffer) 1340 : null; 1341 final int scalarKeySortedTablesOffset = _scalarKeySortedTables?.isNotEmpty == true 1342 ? fbBuilder.writeList(_scalarKeySortedTables.map((b) => b.getOrCreateOffset(fbBuilder)).toList()) 1343 : null; 1344 1345 fbBuilder.startTable(); 1346 if (_pos != null) { 1347 fbBuilder.addStruct(0, _pos.finish(fbBuilder)); 1348 } 1349 fbBuilder.addInt16(1, _mana); 1350 fbBuilder.addInt16(2, _hp); 1351 if (nameOffset != null) { 1352 fbBuilder.addOffset(3, nameOffset); 1353 } 1354 if (inventoryOffset != null) { 1355 fbBuilder.addOffset(5, inventoryOffset); 1356 } 1357 fbBuilder.addUint8(6, _color?.value); 1358 fbBuilder.addUint8(7, _testType?.value); 1359 if (testOffset != null) { 1360 fbBuilder.addOffset(8, testOffset); 1361 } 1362 if (test4Offset != null) { 1363 fbBuilder.addOffset(9, test4Offset); 1364 } 1365 if (testarrayofstringOffset != null) { 1366 fbBuilder.addOffset(10, testarrayofstringOffset); 1367 } 1368 if (testarrayoftablesOffset != null) { 1369 fbBuilder.addOffset(11, testarrayoftablesOffset); 1370 } 1371 if (enemyOffset != null) { 1372 fbBuilder.addOffset(12, enemyOffset); 1373 } 1374 if (testnestedflatbufferOffset != null) { 1375 fbBuilder.addOffset(13, testnestedflatbufferOffset); 1376 } 1377 if (testemptyOffset != null) { 1378 fbBuilder.addOffset(14, testemptyOffset); 1379 } 1380 fbBuilder.addBool(15, _testbool); 1381 fbBuilder.addInt32(16, _testhashs32Fnv1); 1382 fbBuilder.addUint32(17, _testhashu32Fnv1); 1383 fbBuilder.addInt64(18, _testhashs64Fnv1); 1384 fbBuilder.addUint64(19, _testhashu64Fnv1); 1385 fbBuilder.addInt32(20, _testhashs32Fnv1a); 1386 fbBuilder.addUint32(21, _testhashu32Fnv1a); 1387 fbBuilder.addInt64(22, _testhashs64Fnv1a); 1388 fbBuilder.addUint64(23, _testhashu64Fnv1a); 1389 if (testarrayofboolsOffset != null) { 1390 fbBuilder.addOffset(24, testarrayofboolsOffset); 1391 } 1392 fbBuilder.addFloat32(25, _testf); 1393 fbBuilder.addFloat32(26, _testf2); 1394 fbBuilder.addFloat32(27, _testf3); 1395 if (testarrayofstring2Offset != null) { 1396 fbBuilder.addOffset(28, testarrayofstring2Offset); 1397 } 1398 if (testarrayofsortedstructOffset != null) { 1399 fbBuilder.addOffset(29, testarrayofsortedstructOffset); 1400 } 1401 if (flexOffset != null) { 1402 fbBuilder.addOffset(30, flexOffset); 1403 } 1404 if (test5Offset != null) { 1405 fbBuilder.addOffset(31, test5Offset); 1406 } 1407 if (vectorOfLongsOffset != null) { 1408 fbBuilder.addOffset(32, vectorOfLongsOffset); 1409 } 1410 if (vectorOfDoublesOffset != null) { 1411 fbBuilder.addOffset(33, vectorOfDoublesOffset); 1412 } 1413 if (parentNamespaceTestOffset != null) { 1414 fbBuilder.addOffset(34, parentNamespaceTestOffset); 1415 } 1416 if (vectorOfReferrablesOffset != null) { 1417 fbBuilder.addOffset(35, vectorOfReferrablesOffset); 1418 } 1419 fbBuilder.addUint64(36, _singleWeakReference); 1420 if (vectorOfWeakReferencesOffset != null) { 1421 fbBuilder.addOffset(37, vectorOfWeakReferencesOffset); 1422 } 1423 if (vectorOfStrongReferrablesOffset != null) { 1424 fbBuilder.addOffset(38, vectorOfStrongReferrablesOffset); 1425 } 1426 fbBuilder.addUint64(39, _coOwningReference); 1427 if (vectorOfCoOwningReferencesOffset != null) { 1428 fbBuilder.addOffset(40, vectorOfCoOwningReferencesOffset); 1429 } 1430 fbBuilder.addUint64(41, _nonOwningReference); 1431 if (vectorOfNonOwningReferencesOffset != null) { 1432 fbBuilder.addOffset(42, vectorOfNonOwningReferencesOffset); 1433 } 1434 fbBuilder.addUint8(43, _anyUniqueType?.value); 1435 if (anyUniqueOffset != null) { 1436 fbBuilder.addOffset(44, anyUniqueOffset); 1437 } 1438 fbBuilder.addUint8(45, _anyAmbiguousType?.value); 1439 if (anyAmbiguousOffset != null) { 1440 fbBuilder.addOffset(46, anyAmbiguousOffset); 1441 } 1442 if (vectorOfEnumsOffset != null) { 1443 fbBuilder.addOffset(47, vectorOfEnumsOffset); 1444 } 1445 fbBuilder.addInt8(48, _signedEnum?.value); 1446 if (testrequirednestedflatbufferOffset != null) { 1447 fbBuilder.addOffset(49, testrequirednestedflatbufferOffset); 1448 } 1449 if (scalarKeySortedTablesOffset != null) { 1450 fbBuilder.addOffset(50, scalarKeySortedTablesOffset); 1451 } 1452 return fbBuilder.endTable(); 1453 } 1454 1455 /// Convenience method to serialize to byte list. 1456 @override 1457 Uint8List toBytes([String fileIdentifier]) { 1458 fb.Builder fbBuilder = new fb.Builder(); 1459 int offset = finish(fbBuilder); 1460 return fbBuilder.finish(offset, fileIdentifier); 1461 } 1462} 1463class TypeAliases { 1464 TypeAliases._(this._bc, this._bcOffset); 1465 factory TypeAliases(List<int> bytes) { 1466 fb.BufferContext rootRef = new fb.BufferContext.fromBytes(bytes); 1467 return reader.read(rootRef, 0); 1468 } 1469 1470 static const fb.Reader<TypeAliases> reader = const _TypeAliasesReader(); 1471 1472 final fb.BufferContext _bc; 1473 final int _bcOffset; 1474 1475 int get i8 => const fb.Int8Reader().vTableGet(_bc, _bcOffset, 4, 0); 1476 int get u8 => const fb.Uint8Reader().vTableGet(_bc, _bcOffset, 6, 0); 1477 int get i16 => const fb.Int16Reader().vTableGet(_bc, _bcOffset, 8, 0); 1478 int get u16 => const fb.Uint16Reader().vTableGet(_bc, _bcOffset, 10, 0); 1479 int get i32 => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 12, 0); 1480 int get u32 => const fb.Uint32Reader().vTableGet(_bc, _bcOffset, 14, 0); 1481 int get i64 => const fb.Int64Reader().vTableGet(_bc, _bcOffset, 16, 0); 1482 int get u64 => const fb.Uint64Reader().vTableGet(_bc, _bcOffset, 18, 0); 1483 double get f32 => const fb.Float32Reader().vTableGet(_bc, _bcOffset, 20, 0.0); 1484 double get f64 => const fb.Float64Reader().vTableGet(_bc, _bcOffset, 22, 0.0); 1485 List<int> get v8 => const fb.ListReader<int>(const fb.Int8Reader()).vTableGet(_bc, _bcOffset, 24, null); 1486 List<double> get vf64 => const fb.ListReader<double>(const fb.Float64Reader()).vTableGet(_bc, _bcOffset, 26, null); 1487 1488 @override 1489 String toString() { 1490 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}'; 1491 } 1492} 1493 1494class _TypeAliasesReader extends fb.TableReader<TypeAliases> { 1495 const _TypeAliasesReader(); 1496 1497 @override 1498 TypeAliases createObject(fb.BufferContext bc, int offset) => 1499 new TypeAliases._(bc, offset); 1500} 1501 1502class TypeAliasesBuilder { 1503 TypeAliasesBuilder(this.fbBuilder) { 1504 assert(fbBuilder != null); 1505 } 1506 1507 final fb.Builder fbBuilder; 1508 1509 void begin() { 1510 fbBuilder.startTable(); 1511 } 1512 1513 int addI8(int i8) { 1514 fbBuilder.addInt8(0, i8); 1515 return fbBuilder.offset; 1516 } 1517 int addU8(int u8) { 1518 fbBuilder.addUint8(1, u8); 1519 return fbBuilder.offset; 1520 } 1521 int addI16(int i16) { 1522 fbBuilder.addInt16(2, i16); 1523 return fbBuilder.offset; 1524 } 1525 int addU16(int u16) { 1526 fbBuilder.addUint16(3, u16); 1527 return fbBuilder.offset; 1528 } 1529 int addI32(int i32) { 1530 fbBuilder.addInt32(4, i32); 1531 return fbBuilder.offset; 1532 } 1533 int addU32(int u32) { 1534 fbBuilder.addUint32(5, u32); 1535 return fbBuilder.offset; 1536 } 1537 int addI64(int i64) { 1538 fbBuilder.addInt64(6, i64); 1539 return fbBuilder.offset; 1540 } 1541 int addU64(int u64) { 1542 fbBuilder.addUint64(7, u64); 1543 return fbBuilder.offset; 1544 } 1545 int addF32(double f32) { 1546 fbBuilder.addFloat32(8, f32); 1547 return fbBuilder.offset; 1548 } 1549 int addF64(double f64) { 1550 fbBuilder.addFloat64(9, f64); 1551 return fbBuilder.offset; 1552 } 1553 int addV8Offset(int offset) { 1554 fbBuilder.addOffset(10, offset); 1555 return fbBuilder.offset; 1556 } 1557 int addVf64Offset(int offset) { 1558 fbBuilder.addOffset(11, offset); 1559 return fbBuilder.offset; 1560 } 1561 1562 int finish() { 1563 return fbBuilder.endTable(); 1564 } 1565} 1566 1567class TypeAliasesObjectBuilder extends fb.ObjectBuilder { 1568 final int _i8; 1569 final int _u8; 1570 final int _i16; 1571 final int _u16; 1572 final int _i32; 1573 final int _u32; 1574 final int _i64; 1575 final int _u64; 1576 final double _f32; 1577 final double _f64; 1578 final List<int> _v8; 1579 final List<double> _vf64; 1580 1581 TypeAliasesObjectBuilder({ 1582 int i8, 1583 int u8, 1584 int i16, 1585 int u16, 1586 int i32, 1587 int u32, 1588 int i64, 1589 int u64, 1590 double f32, 1591 double f64, 1592 List<int> v8, 1593 List<double> vf64, 1594 }) 1595 : _i8 = i8, 1596 _u8 = u8, 1597 _i16 = i16, 1598 _u16 = u16, 1599 _i32 = i32, 1600 _u32 = u32, 1601 _i64 = i64, 1602 _u64 = u64, 1603 _f32 = f32, 1604 _f64 = f64, 1605 _v8 = v8, 1606 _vf64 = vf64; 1607 1608 /// Finish building, and store into the [fbBuilder]. 1609 @override 1610 int finish( 1611 fb.Builder fbBuilder) { 1612 assert(fbBuilder != null); 1613 final int v8Offset = _v8?.isNotEmpty == true 1614 ? fbBuilder.writeListInt8(_v8) 1615 : null; 1616 final int vf64Offset = _vf64?.isNotEmpty == true 1617 ? fbBuilder.writeListFloat64(_vf64) 1618 : null; 1619 1620 fbBuilder.startTable(); 1621 fbBuilder.addInt8(0, _i8); 1622 fbBuilder.addUint8(1, _u8); 1623 fbBuilder.addInt16(2, _i16); 1624 fbBuilder.addUint16(3, _u16); 1625 fbBuilder.addInt32(4, _i32); 1626 fbBuilder.addUint32(5, _u32); 1627 fbBuilder.addInt64(6, _i64); 1628 fbBuilder.addUint64(7, _u64); 1629 fbBuilder.addFloat32(8, _f32); 1630 fbBuilder.addFloat64(9, _f64); 1631 if (v8Offset != null) { 1632 fbBuilder.addOffset(10, v8Offset); 1633 } 1634 if (vf64Offset != null) { 1635 fbBuilder.addOffset(11, vf64Offset); 1636 } 1637 return fbBuilder.endTable(); 1638 } 1639 1640 /// Convenience method to serialize to byte list. 1641 @override 1642 Uint8List toBytes([String fileIdentifier]) { 1643 fb.Builder fbBuilder = new fb.Builder(); 1644 int offset = finish(fbBuilder); 1645 return fbBuilder.finish(offset, fileIdentifier); 1646 } 1647} 1648