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

BigInt intrinsics do not handle BigInts sent between isolates #34752

alexmarkov opened this Issue Oct 11, 2018 · 0 comments


None yet
1 participant

alexmarkov commented Oct 11, 2018

BigInt is backed by TypedData (Uint32List), which is converted to ExternalTypedData when sent between isolates if it exceeds certain size (kExternalizeTypedDataThreshold in

However, BigInt intrinsics do no account for this and handle only regular TypedData. This results in incorrect behavior of arithmetic operations after receiving such BigInt.


import 'dart:io';
import 'dart:isolate';

import "package:expect/expect.dart";

const int kValue = 12345678;
const int kShift = 8192 * 8;

void verify(BigInt x) {
  BigInt y = x >> kShift;
  Expect.equals("$kValue", "$y");

void main() {
  BigInt big = BigInt.from(kValue) << kShift;

  final rp = new ReceivePort();
  rp.listen((dynamic data) {
    BigInt received = data as BigInt;
    BigInt x = received + -;

This issue is somewhat similar to flutter/flutter#22796, as it is also caused by morphing TypedData to ExternalTypedData when it is sent between isolates.

/cc @crelier @mraleph @rmacnak-google

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment