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

flutter web got exception RangeError #2

Closed
oonid opened this issue Jul 30, 2020 · 3 comments
Closed

flutter web got exception RangeError #2

oonid opened this issue Jul 30, 2020 · 3 comments

Comments

@oonid
Copy link

oonid commented Jul 30, 2020

Hi,
I try to use stellar_flutter_sdk in flutter web.
the code simply call KeyPair.random().

I got this exception:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following RangeError was thrown building MyApp(dirty):
max must be in range 0 < max ≤ 2^32, was 0

The relevant error-causing widget was:
  MyApp file:///Users/x/y/z/lib/main.dart:5:10

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 214:49  throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart 314:7             nextInt
packages/tweetnacl/src/tweetnacl_base.dart 3150:27                            randombytes_array_len
packages/tweetnacl/src/tweetnacl_base.dart 3139:12                            randombytes_array
packages/tweetnacl/src/tweetnacl_base.dart 3143:12                            randombytes
packages/stellar_flutter_sdk/src/key_pair.dart 176:46                         random

that was using Chrome (web), ddc runtime.
the functionality has no problem on the Android emulator.

my pubspec.yaml:

  stellar_flutter_sdk: ^1.0.4

I saw both packages stellar_flutter_sdk and tweetnacl, has flutter web badge support.

thoughts?

thank you.

@christian-rogobete
Copy link
Contributor

Hi @oonid thank you for reposting this. I will take a look next week and let I will let you know.

@christian-rogobete
Copy link
Contributor

christian-rogobete commented Oct 21, 2020

Hello @oonid the issue comes from the tweetnacl code. I first tried to solve it there, but then a new issue appears that is not an easy fix. I added this new issue to the tweetnacl repo. Hopefully they fix it, otherwise we will need to find another solution. For now the sdk is not usable with the flutter web beta but good for android and ios. I will remove the web badge in pub.dev with the next release if tweetnacl is not fixed until then.

@oonid
Copy link
Author

oonid commented Oct 22, 2020

thank you @christian-rogobete for the updates.

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

No branches or pull requests

2 participants