Closed xylobol closed 3 years ago
Alright, so I've swapped out dart:io
for package:universal_io
. All unit tests pass when running on the VM (pub run test --platform=vm
), but it fails miserably with pub run test --platform=chrome
and --platform=firefox
with the following:
⬢[director@toolbox msgpack_dart]$ pub run test --reporter=expanded --platform=firefox
00:00 +0: compiling test/msgpack_dart_test.dart
test/msgpack_dart_test.dart:175:33:
Error: The integer literal 9223372036854775807 can't be represented exactly in JavaScript.
List<int> encoded = serialize(9223372036854775807);
^^^^^^^^^^^^^^^^^^^
test/msgpack_dart_test.dart:414:24:
Error: The integer literal 9223372036854775807 can't be represented exactly in JavaScript.
expect(value, equals(9223372036854775807));
^^^^^^^^^^^^^^^^^^^
Error: Compilation failed.
00:00 +0 -1: compiling test/msgpack_dart_test.dart [E]
Failed to load "test/msgpack_dart_test.dart": dart2js failed.
00:00 +0 -1: Some tests failed.
So, it would appear a limit of JavaScript is being hit. The "solution" may be to move to the BigInt class, but this may incur performance issues.
Looking even further, a lot of the "solutions" would be near-complete rewrites of the bulk of the library. As this is really more of a feature request, and the library is otherwise fantastic, I'm going to be closing this issue in favor of looking for/creating an alternate library.
The library only works on native runtimes, i.e. where it can access
dart:io
. I'm going to take a look and try to fix it. Will keep this thread up-to-date.