The `BigInt.from()` constructor allocates a big integer from the provided numeric value.
The syntax of BigInt.BigInt.from constructor is:
BigInt.from(num value)
This BigInt.from constructor of BigInt allocates a big integer from the provided value
number.
Parameter | Optional/Required | Description |
---|---|---|
value | required | the number to create a BigInt from |
In this example,
number
with a value of 123456789
.BigInt.from()
constructor to create a BigInt
from the number
.BigInt
.void main() {
num number = 123456789;
BigInt bigIntFromNumber = BigInt.from(number);
print('BigInt from number: $bigIntFromNumber');
}
BigInt from number: 123456789
In this example,
char
with a value of 'A'
.BigInt.from()
constructor to create a BigInt
from the character code of 'A'
.BigInt
.void main() {
String char = 'A';
BigInt bigIntFromChar = BigInt.from(char.codeUnitAt(0));
print('BigInt from char: $bigIntFromChar');
}
BigInt from char: 65
In this Dart tutorial, we learned about BigInt.from constructor of BigInt: the syntax and few working examples with output and detailed explanation for each example.