bignum 0.1.0

  • Installing
  • Versions
  • 43


Getting Started

Create a Dart project and add a pubspec.yaml file to it

  bignum: any


    git: git://

and run pub install to install bignum (including its dependencies). Now add import

import 'package:bignum/bignum.dart';



import 'package:bignum/bignum.dart';
void main() {
  BigInteger x = new BigInteger("12341234123412341234");
  BigInteger y = new BigInteger("100");
  var z = x * y * x;
  print("base 10: z = ${z.toString()}");
  print("base 16: z = ${z.toString(16)}");
  print("base 2: z = ${z.toString(2)}");


base 10: z = 15230605968887717854389148085725664275600
base 16: z = 2cc23c02bae6a6051a5ce673189c3a6c90
base 2: z = 10110011000010001111000000001010111010111001101010011000000101000110100101110011100110011100110001100010011100001110100110110010010000


Tobase. The sample currently has known issues with bitwise operators.


Currently few known bugs exist while compiling from dart2js. One is working with bitwise operators, the internal implementation of shift operators with dart2js does not handle the same way as the VM. Most of this code was ported from v8 benchmark suite. Tom Wu is to thank for the core javascript implementation and the v8 team for optimizations on different javascript virtual machines.

Bugs & Testing

Please feel free to add issues on github issue tracker, we would like to provide a solid library for the community to use.


Changelog - dart-bignum

0.1.0 2015-02-03 (SDK 1.14.0)

  • Cleaned up interface
  • Hide platform-specific implementations
  • Removed unused legacy implementation

0.0.7 2015-06-29 (SDK 1.11.0)

  • Use native big integer when run in dartvm(>= 1.11.0)

0.0.6 2014-09-02 (SDK 1.6.0-dev.9.7 r39537)

  • Used Uint8List instead of List<int> for performance improvement.

0.0.5 2014-02-10 (SDK 1.2.0-dev.4.0 r32426)

  • Add a leading 0 to binary data in fromBytes() constructor if most significant bit set

1. Depend on it

Add this to your package's pubspec.yaml file:

  bignum: "^0.1.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:bignum/bignum.dart';
Version Uploaded Documentation Archive
0.1.0 Feb 3, 2016 Go to the documentation of bignum 0.1.0 Download bignum 0.1.0 archive
0.0.7 Jun 30, 2015 Go to the documentation of bignum 0.0.7 Download bignum 0.0.7 archive
0.0.6 Sep 3, 2014 Go to the documentation of bignum 0.0.6 Download bignum 0.0.6 archive
0.0.5 Feb 19, 2014 Go to the documentation of bignum 0.0.5 Download bignum 0.0.5 archive
0.0.4 Jan 14, 2014 Go to the documentation of bignum 0.0.4 Download bignum 0.0.4 archive
0.0.3 Apr 27, 2013 Go to the documentation of bignum 0.0.3 Download bignum 0.0.3 archive
0.0.1 Sep 25, 2012 Go to the documentation of bignum 0.0.1 Download bignum 0.0.1 archive


This feature is new.
We welcome feedback.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Dec 6, 2017
  • Dart: 2.0.0-dev.8.0
  • pana: 0.7.3+1


Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Overall score:
Weighted score of the above. [more]


Detected platforms:

Error(s) prevent platform classification.


  • Fix lib/src/big_integer_v8.dart.

    Strong-mode analysis of lib/src/big_integer_v8.dart failed with the following error:

    line: 456 col: 3
    Invalid override. The type of 'BigIntegerV8.copyTo' ('(BigIntegerV8) → void') isn't a subtype of 'BigInteger.copyTo' ('(dynamic) → void').

  • Fix lib/src/big_integer_dartvm.dart.

    Strong-mode analysis of lib/src/big_integer_dartvm.dart failed with the following error:

    line: 250 col: 3
    Invalid override. The type of 'BigIntegerDartvm.copyTo' ('(BigIntegerDartvm) → void') isn't a subtype of 'BigInteger.copyTo' ('(dynamic) → void').


Package Constraint Resolved Available
Direct dependencies
fixnum >=0.10.2 <0.11.0 0.10.6
Dev dependencies
unittest >=0.9.0 <0.10.0