sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Inability to Convert Dart BigInt to JSBigInt using new js_interop

Open maks-yakauleu opened this issue 1 year ago • 2 comments
trafficstars

There is currently no straightforward way to convert a Dart BigInt to a JSBigInt using the dart:js_interop package.

Steps to Reproduce:

  1. Attempt to pass a Dart BigInt to a JavaScript function that expects a JSBigInt.
  2. Observe that there is no built-in method to perform this conversion directly.

Expected Behavior: There should be a built-in method or straightforward way to convert a Dart BigInt to a JSBigInt, similar to how other types like String, num, and List are handled. (toDart, toJS)

Dart 3.4.3 (stable) Flutter 3.22.2 (stable)

maks-yakauleu avatar Jun 28 '24 15:06 maks-yakauleu

Summary: Users cannot directly convert Dart BigInt to JavaScript BigInt using dart:js_interop. This prevents passing BigInt values to JavaScript functions expecting BigInt arguments.

dart-github-bot avatar Jun 28 '24 15:06 dart-github-bot

Duplicate of https://github.com/dart-lang/sdk/issues/56539

I'm going to duplicate this in favor of that bug since that has a bit more detail on how to do this yourself until we add it to dart:js_interop, but this request is still being tracked.

srujzs avatar Aug 21 '24 21:08 srujzs