Skip to content

Commit

Permalink
dart: Fix incorrect write in Float64 write method (google#8290)
Browse files Browse the repository at this point in the history
Co-authored-by: Llamadmiral <[email protected]>
Co-authored-by: Derek Bailey <[email protected]>
  • Loading branch information
3 people authored and Jochen Parmentier committed Oct 29, 2024
1 parent 0b64f0c commit dfd27ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dart/lib/flat_buffers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ class Builder {
/// Updates the [offset] pointer. This method is intended for use when writing structs to the buffer.
void putFloat64(double value) {
_prepare(_sizeofFloat64, 1);
_setFloat32AtTail(_tail, value);
_setFloat64AtTail(_tail, value);
}

/// Writes a Float32 to the tail of the buffer after preparing space for it.
Expand Down
4 changes: 4 additions & 0 deletions dart/test/flat_buffers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ class BuilderTest {
..addTestarrayofstringOffset(testArrayOfString);
final mon = monBuilder.finish();
fbBuilder.finish(mon);

final mon3 = example.Monster(fbBuilder.buffer);
expect(mon3.name, 'MyMonster');
expect(mon3.pos!.test1, 3.0);
}

void test_error_addInt32_withoutStartTable([Builder? builder]) {
Expand Down

0 comments on commit dfd27ab

Please sign in to comment.