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