Skip to content

[Dart] Support required non-scalar fields#9123

Open
KirtiRamchandani wants to merge 1 commit into
google:masterfrom
KirtiRamchandani:fix/dart-required-fields
Open

[Dart] Support required non-scalar fields#9123
KirtiRamchandani wants to merge 1 commit into
google:masterfrom
KirtiRamchandani:fix/dart-required-fields

Conversation

@KirtiRamchandani
Copy link
Copy Markdown

@KirtiRamchandani KirtiRamchandani commented Jun 4, 2026

Summary

  • Treat Dart table fields marked (required) as non-null when they do not have a default value.
  • Emit non-null getters, object API constructor fields, object builder fields, and raw offset builder parameters for required non-scalar fields.
  • Add a Dart fixture covering a required string and a required enum vector.

Fixes #9093

Tests

  • cmake -S . -B build -G Ninja -DFLATBUFFERS_BUILD_TESTS=OFF
  • cmake --build build --target flatc
  • ./build/flatc.exe --dart --gen-object-api -o ./dart/test ./dart/test/enums.fbs
  • Regenerated enums_generated.dart matched a temp regeneration with fc.exe /b
  • git diff --check

Not run: dart test because the Dart SDK is not installed in this Windows workspace I am working on atm.

@github-actions github-actions Bot added c++ codegen Involving generating code from schema dart labels Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema dart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Dart] Support for required non-scalars

1 participant