Skip to content

fix(dart): use BigInt for int64 serialization on web#92

Open
dillon-0 wants to merge 2 commits intozefchain:mainfrom
dillon-0:fix/dart-web-int64
Open

fix(dart): use BigInt for int64 serialization on web#92
dillon-0 wants to merge 2 commits intozefchain:mainfrom
dillon-0:fix/dart-web-int64

Conversation

@dillon-0
Copy link
Copy Markdown

@dillon-0 dillon-0 commented Mar 24, 2026

Summary

ByteData.getInt64() and ByteData.setInt64() throw UnsupportedError on Dart web because JavaScript numbers are 64-bit doubles with no native 64-bit integer support.

  • deserializeInt64() now uses _bytesToBigInt() — the same approach already used by deserializeUint64()
  • serializeInt64() now uses manual byte-splitting — matching the pattern in serializeUint64()

Context

This was discovered while using rinf (a Rust-Flutter bridge that uses serde-generate for Dart bindings). Any rinf signal struct containing i64 fields would silently fail deserialization on Dart web — send_signal_to_dart() succeeded on the Rust/WASM side, but the Dart callback threw an uncaught UnsupportedError during bincode deserialization, so the signal was never delivered.

The fix is minimal: both methods already had working cross-platform equivalents in deserializeUint64/serializeUint64 — this PR applies the same pattern to the signed variants.

Dillon added 2 commits March 23, 2026 23:19
ByteData.getInt64() and ByteData.setInt64() throw UnsupportedError
on Dart web because JavaScript numbers are 64-bit doubles with no
native 64-bit integer support.

deserializeInt64() now uses _bytesToBigInt() (the same approach
already used by deserializeUint64()). serializeInt64() now uses
manual byte-splitting (matching serializeUint64()).

This was discovered via rinf (Rust-Flutter bridge) where any signal
containing i64 fields silently failed deserialization on web — the
signal was sent successfully from Rust but Dart never received it
because the bincode deserialization threw an uncaught UnsupportedError.
@dillon-0 dillon-0 force-pushed the fix/dart-web-int64 branch from 45ceec2 to 6d87c57 Compare March 24, 2026 06:20
@dillon-0 dillon-0 marked this pull request as ready for review March 24, 2026 06:26
@dillon-0 dillon-0 requested a review from ma2bd as a code owner March 24, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant