google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library

Home Page:https://flatbuffers.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

insertjokehere opened this issue · 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

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

This is still an issue