Skip to content
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

Does not build on Flutter Web: static const Duration eternal = Duration(days: 8999999999999999991) #5

Closed
matthewtsmith opened this issue Apr 13, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@matthewtsmith
Copy link

Describe the bug
After adding stash as a dependency to my pubspec.yaml, my application will no longer build for web

To Reproduce

  1. Add stash: ^2.0.0-nullsafety.3 to pubspec.yaml
  2. Run flutter run -d chrome
  3. See error

../../Library/flutter/.pub-cache/hosted/pub.dartlang.org/stash-2.0.0-nullsafety.3/lib/src/api/expiry/expiry_policy.dart:8:50: Error: The integer literal 8999999999999999991 can't be represented exactly in JavaScript.
Try changing the literal to something that can be represented in Javascript. In Javascript 9000000000000000000 is the nearest value that can be represented exactly.
static const Duration eternal = Duration(days: 8999999999999999991);

Version
Dart SDK version: 2.13.0-116.0.dev (dev) (Sun Mar 7 18:57:20 2021 -0800) on "macos_x64"

Additional context
Flutter 2.1.0-12.2.pre • channel beta • git@github.com:flutter/flutter.git
Framework • revision 5bedb7b1d5 (4 weeks ago) • 2021-03-17 17:06:30 -0700
Engine • revision 711ab3fda0
Tools • Dart 2.13.0 (build 2.13.0-116.0.dev)

@ivoleitao
Copy link
Owner

Thanks for the report. I'll have to think this better to be honest.

This issue in particular is easy to solve but there is more problems with dartjs as the unit tests do not run for a number of reasons some easy to solve others not that trivial like this one: dart-lang/sdk#10275

I have for example an extension to write datetime with MsgPack that uses:

writer.writeUint64(object.microsecondsSinceEpoch); in order to serialize and deserialize the same thing

From documentation microsecondsSinceEpoch:
Note that this value does not fit into 53 bits (the size of a IEEE double). A JavaScript number is not able to hold this value.

In the end I can make this compile but some advanced scenarios would break in dartjs (not stash related but any dependency that needs serialization / deserialization like stash_hive or stash_disk)

I will take a look during the weekend

@ivoleitao
Copy link
Owner

I was able to solve some of the problems above but the unit tests are not running on dartjs yet. It would take some time to investigate

@ivoleitao ivoleitao self-assigned this Apr 15, 2021
@ivoleitao ivoleitao added the bug Something isn't working label Apr 15, 2021
@ivoleitao
Copy link
Owner

Fixed with 2.0.0-nullsafety.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants