pack method

  1. @override
int pack(
  1. Builder fbBuilder
)
override

Serialize the object using the given builder, returning the offset.

Implementation

@override
int pack(fb.Builder fbBuilder) {
  final int? nameOffset = name == null ? null
      : fbBuilder.writeString(name!);
  final int? childrenOffset = children == null ? null
      : fbBuilder.writeListInt32(children!);
  final int? meshPrimitivesOffset = meshPrimitives == null ? null
      : fbBuilder.writeList(meshPrimitives!.map((b) => b.pack(fbBuilder)).toList());
  final int? skinOffset = skin?.pack(fbBuilder);
  fbBuilder.startTable(5);
  fbBuilder.addOffset(0, nameOffset);
  fbBuilder.addOffset(1, childrenOffset);
  if (transform != null) {
    fbBuilder.addStruct(2, transform!.pack(fbBuilder));
  }
  fbBuilder.addOffset(3, meshPrimitivesOffset);
  fbBuilder.addOffset(4, skinOffset);
  return fbBuilder.endTable();
}