1// automatically generated by the FlatBuffers compiler, do not modify 2// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names 3 4library keyword_test; 5 6import 'dart:typed_data' show Uint8List; 7import 'package:flat_buffers/flat_buffers.dart' as fb; 8 9 10enum Abc { 11 $void(0), 12 where(1), 13 stackalloc(2); 14 15 final int value; 16 const Abc(this.value); 17 18 factory Abc.fromValue(int value) { 19 switch (value) { 20 case 0: return Abc.$void; 21 case 1: return Abc.where; 22 case 2: return Abc.stackalloc; 23 default: throw StateError('Invalid value $value for bit flag enum'); 24 } 25 } 26 27 static Abc? _createOrNull(int? value) => 28 value == null ? null : Abc.fromValue(value); 29 30 static const int minValue = 0; 31 static const int maxValue = 2; 32 static const fb.Reader<Abc> reader = _AbcReader(); 33} 34 35class _AbcReader extends fb.Reader<Abc> { 36 const _AbcReader(); 37 38 @override 39 int get size => 4; 40 41 @override 42 Abc read(fb.BufferContext bc, int offset) => 43 Abc.fromValue(const fb.Int32Reader().read(bc, offset)); 44} 45 46enum Public { 47 NONE(0); 48 49 final int value; 50 const Public(this.value); 51 52 factory Public.fromValue(int value) { 53 switch (value) { 54 case 0: return Public.NONE; 55 default: throw StateError('Invalid value $value for bit flag enum'); 56 } 57 } 58 59 static Public? _createOrNull(int? value) => 60 value == null ? null : Public.fromValue(value); 61 62 static const int minValue = 0; 63 static const int maxValue = 0; 64 static const fb.Reader<Public> reader = _PublicReader(); 65} 66 67class _PublicReader extends fb.Reader<Public> { 68 const _PublicReader(); 69 70 @override 71 int get size => 4; 72 73 @override 74 Public read(fb.BufferContext bc, int offset) => 75 Public.fromValue(const fb.Int32Reader().read(bc, offset)); 76} 77 78enum KeywordsInUnionTypeId { 79 NONE(0), 80 $static(1), 81 internal(2); 82 83 final int value; 84 const KeywordsInUnionTypeId(this.value); 85 86 factory KeywordsInUnionTypeId.fromValue(int value) { 87 switch (value) { 88 case 0: return KeywordsInUnionTypeId.NONE; 89 case 1: return KeywordsInUnionTypeId.$static; 90 case 2: return KeywordsInUnionTypeId.internal; 91 default: throw StateError('Invalid value $value for bit flag enum'); 92 } 93 } 94 95 static KeywordsInUnionTypeId? _createOrNull(int? value) => 96 value == null ? null : KeywordsInUnionTypeId.fromValue(value); 97 98 static const int minValue = 0; 99 static const int maxValue = 2; 100 static const fb.Reader<KeywordsInUnionTypeId> reader = _KeywordsInUnionTypeIdReader(); 101} 102 103class _KeywordsInUnionTypeIdReader extends fb.Reader<KeywordsInUnionTypeId> { 104 const _KeywordsInUnionTypeIdReader(); 105 106 @override 107 int get size => 1; 108 109 @override 110 KeywordsInUnionTypeId read(fb.BufferContext bc, int offset) => 111 KeywordsInUnionTypeId.fromValue(const fb.Uint8Reader().read(bc, offset)); 112} 113 114class KeywordsInTable { 115 KeywordsInTable._(this._bc, this._bcOffset); 116 factory KeywordsInTable(List<int> bytes) { 117 final rootRef = fb.BufferContext.fromBytes(bytes); 118 return reader.read(rootRef, 0); 119 } 120 121 static const fb.Reader<KeywordsInTable> reader = _KeywordsInTableReader(); 122 123 final fb.BufferContext _bc; 124 final int _bcOffset; 125 126 Abc get $is => Abc.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 4, 0)); 127 Public get private => Public.fromValue(const fb.Int32Reader().vTableGet(_bc, _bcOffset, 6, 0)); 128 int get type => const fb.Int32Reader().vTableGet(_bc, _bcOffset, 8, 0); 129 bool get $default => const fb.BoolReader().vTableGet(_bc, _bcOffset, 10, false); 130 131 @override 132 String toString() { 133 return 'KeywordsInTable{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}'; 134 } 135 136 KeywordsInTableT unpack() => KeywordsInTableT( 137 $is: $is, 138 private: private, 139 type: type, 140 $default: $default); 141 142 static int pack(fb.Builder fbBuilder, KeywordsInTableT? object) { 143 if (object == null) return 0; 144 return object.pack(fbBuilder); 145 } 146} 147 148class KeywordsInTableT implements fb.Packable { 149 Abc $is; 150 Public private; 151 int type; 152 bool $default; 153 154 KeywordsInTableT({ 155 this.$is = Abc.$void, 156 this.private = Public.NONE, 157 this.type = 0, 158 this.$default = false}); 159 160 @override 161 int pack(fb.Builder fbBuilder) { 162 fbBuilder.startTable(4); 163 fbBuilder.addInt32(0, $is.value); 164 fbBuilder.addInt32(1, private.value); 165 fbBuilder.addInt32(2, type); 166 fbBuilder.addBool(3, $default); 167 return fbBuilder.endTable(); 168 } 169 170 @override 171 String toString() { 172 return 'KeywordsInTableT{\$is: ${$is}, private: ${private}, type: ${type}, \$default: ${$default}}'; 173 } 174} 175 176class _KeywordsInTableReader extends fb.TableReader<KeywordsInTable> { 177 const _KeywordsInTableReader(); 178 179 @override 180 KeywordsInTable createObject(fb.BufferContext bc, int offset) => 181 KeywordsInTable._(bc, offset); 182} 183 184class KeywordsInTableBuilder { 185 KeywordsInTableBuilder(this.fbBuilder); 186 187 final fb.Builder fbBuilder; 188 189 void begin() { 190 fbBuilder.startTable(4); 191 } 192 193 int addIs(Abc? $is) { 194 fbBuilder.addInt32(0, $is?.value); 195 return fbBuilder.offset; 196 } 197 int addPrivate(Public? private) { 198 fbBuilder.addInt32(1, private?.value); 199 return fbBuilder.offset; 200 } 201 int addType(int? type) { 202 fbBuilder.addInt32(2, type); 203 return fbBuilder.offset; 204 } 205 int addDefault(bool? $default) { 206 fbBuilder.addBool(3, $default); 207 return fbBuilder.offset; 208 } 209 210 int finish() { 211 return fbBuilder.endTable(); 212 } 213} 214 215class KeywordsInTableObjectBuilder extends fb.ObjectBuilder { 216 final Abc? _$is; 217 final Public? _private; 218 final int? _type; 219 final bool? _$default; 220 221 KeywordsInTableObjectBuilder({ 222 Abc? $is, 223 Public? private, 224 int? type, 225 bool? $default, 226 }) 227 : _$is = $is, 228 _private = private, 229 _type = type, 230 _$default = $default; 231 232 /// Finish building, and store into the [fbBuilder]. 233 @override 234 int finish(fb.Builder fbBuilder) { 235 fbBuilder.startTable(4); 236 fbBuilder.addInt32(0, _$is?.value); 237 fbBuilder.addInt32(1, _private?.value); 238 fbBuilder.addInt32(2, _type); 239 fbBuilder.addBool(3, _$default); 240 return fbBuilder.endTable(); 241 } 242 243 /// Convenience method to serialize to byte list. 244 @override 245 Uint8List toBytes([String? fileIdentifier]) { 246 final fbBuilder = fb.Builder(deduplicateTables: false); 247 fbBuilder.finish(finish(fbBuilder), fileIdentifier); 248 return fbBuilder.buffer; 249 } 250} 251class Table2 { 252 Table2._(this._bc, this._bcOffset); 253 factory Table2(List<int> bytes) { 254 final rootRef = fb.BufferContext.fromBytes(bytes); 255 return reader.read(rootRef, 0); 256 } 257 258 static const fb.Reader<Table2> reader = _Table2Reader(); 259 260 final fb.BufferContext _bc; 261 final int _bcOffset; 262 263 KeywordsInUnionTypeId? get typeType => KeywordsInUnionTypeId._createOrNull(const fb.Uint8Reader().vTableGetNullable(_bc, _bcOffset, 4)); 264 dynamic get type { 265 switch (typeType?.value) { 266 case 1: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6); 267 case 2: return KeywordsInTable.reader.vTableGetNullable(_bc, _bcOffset, 6); 268 default: return null; 269 } 270 } 271 272 @override 273 String toString() { 274 return 'Table2{typeType: ${typeType}, type: ${type}}'; 275 } 276 277 Table2T unpack() => Table2T( 278 typeType: typeType, 279 type: type); 280 281 static int pack(fb.Builder fbBuilder, Table2T? object) { 282 if (object == null) return 0; 283 return object.pack(fbBuilder); 284 } 285} 286 287class Table2T implements fb.Packable { 288 KeywordsInUnionTypeId? typeType; 289 dynamic type; 290 291 Table2T({ 292 this.typeType, 293 this.type}); 294 295 @override 296 int pack(fb.Builder fbBuilder) { 297 final int? typeOffset = type?.pack(fbBuilder); 298 fbBuilder.startTable(2); 299 fbBuilder.addUint8(0, typeType?.value); 300 fbBuilder.addOffset(1, typeOffset); 301 return fbBuilder.endTable(); 302 } 303 304 @override 305 String toString() { 306 return 'Table2T{typeType: ${typeType}, type: ${type}}'; 307 } 308} 309 310class _Table2Reader extends fb.TableReader<Table2> { 311 const _Table2Reader(); 312 313 @override 314 Table2 createObject(fb.BufferContext bc, int offset) => 315 Table2._(bc, offset); 316} 317 318class Table2Builder { 319 Table2Builder(this.fbBuilder); 320 321 final fb.Builder fbBuilder; 322 323 void begin() { 324 fbBuilder.startTable(2); 325 } 326 327 int addTypeType(KeywordsInUnionTypeId? typeType) { 328 fbBuilder.addUint8(0, typeType?.value); 329 return fbBuilder.offset; 330 } 331 int addTypeOffset(int? offset) { 332 fbBuilder.addOffset(1, offset); 333 return fbBuilder.offset; 334 } 335 336 int finish() { 337 return fbBuilder.endTable(); 338 } 339} 340 341class Table2ObjectBuilder extends fb.ObjectBuilder { 342 final KeywordsInUnionTypeId? _typeType; 343 final dynamic _type; 344 345 Table2ObjectBuilder({ 346 KeywordsInUnionTypeId? typeType, 347 dynamic type, 348 }) 349 : _typeType = typeType, 350 _type = type; 351 352 /// Finish building, and store into the [fbBuilder]. 353 @override 354 int finish(fb.Builder fbBuilder) { 355 final int? typeOffset = _type?.getOrCreateOffset(fbBuilder); 356 fbBuilder.startTable(2); 357 fbBuilder.addUint8(0, _typeType?.value); 358 fbBuilder.addOffset(1, typeOffset); 359 return fbBuilder.endTable(); 360 } 361 362 /// Convenience method to serialize to byte list. 363 @override 364 Uint8List toBytes([String? fileIdentifier]) { 365 final fbBuilder = fb.Builder(deduplicateTables: false); 366 fbBuilder.finish(finish(fbBuilder), fileIdentifier); 367 return fbBuilder.buffer; 368 } 369} 370