flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

Flatc does not consistently normalize property names within structs [Dart, master]

Open insertjokehere opened this issue 3 years ago • 0 comments

When generating Dart code, flatc normalizes most properties to "lower camel case" style, except inside structs. This means that schemas like this:

struct Settings {
    foo_bar : uint8;
}

table Content {
    settings : Settings;
}

Will generate invalid Dart code:

class SettingsT implements fb.Packable {
  int fooBar;

  SettingsT({
      required this.fooBar});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.putUint8(foo_bar);
    return fbBuilder.offset;
  }

  @override
  String toString() {
    return 'SettingsT{fooBar: $fooBar}';
  }
}

Note foo_bar vs fooBar

insertjokehere avatar Mar 08 '22 21:03 insertjokehere