-
-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Flutter web compilation: replace int64MaxValue with JavaScript-safe integer constant #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
Co-authored-by: anidotnet <696662+anidotnet@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes Flutter web compilation issues caused by integer literals exceeding JavaScript's MAX_SAFE_INTEGER. The changes replace usage of int64MaxValue (2^63-1) from the dart_numerics package with JavaScript-safe integer values (2^53-1), enabling the package to compile successfully for Flutter web targets.
Key changes:
- Introduced a
_maxSafeIntegerconstant for stream limiting operations - Updated boundary tests to use web-safe literal strings instead of dart_numerics constants
- Removed unused
dart_numericsimports from affected files
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/nitrite/lib/src/collection/operations/read_operations.dart | Added _maxSafeInteger constant (2^53-1) to replace int64MaxValue in stream take operation |
| packages/nitrite/test/collection/nitrite_id_test.dart | Updated boundary test to use JavaScript-safe integer literals as strings |
Comments suppressed due to low confidence (1)
packages/nitrite/lib/src/collection/operations/read_operations.dart:1
- The
compareTomethod inNitriteId(line 64 of nitrite_id.dart) usesint.parse()which may cause issues on Flutter web when comparing IDs with values exceeding JavaScript's MAX_SAFE_INTEGER (2^53-1). While the test now uses web-safe values, any production IDs created from int64 values could still fail comparison operations on web. Consider using BigInt for parsing and comparison, or explicitly document that IDs must not exceed MAX_SAFE_INTEGER on web platforms.
import 'package:nitrite/nitrite.dart';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Flutter web compilation failed because
int64MaxValue(2^63-1) fromdart_numericsexceeds JavaScript'sMAX_SAFE_INTEGER(2^53-1). JavaScript uses double-precision floats for all numbers, causing compilation errors when integer literals exceed the safe range.Changes
int64MaxValuewith_maxSafeInteger = 9007199254740991constant in stream limiting logicint64MaxValue/int64MinValuewith web-safe literal strings in boundary testdart_numericsimports from both filesThe constant serves as a "take all" sentinel value when no explicit limit is set, so the reduced range (2^53-1 vs 2^63-1) has no practical impact on functionality.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.