Show Menu
Cheatography

Dart numbers Cheat Sheet by

view Dart vs C++ in advance

isinfinite

num.isinfinite

sign

num.sign
Returns minus one, zero or plus one depending on the sign and numerical value of the number.

parse()


void main() {
   print(num.parse('12'));
   print(num.parse('10.91'));
}
The parse() static function allows parsing a string containing numeric literal into a number.

Useful functions

Number.abs()
Number.ceil()
Number.co­mpa­reTo(x)
0 if the values are equal. 1 if the current number object is greater than the specified numeric value.-1 if the current number object is lesser than the specified numeric value.
Number.fl­oor()
Number.re­mai­nder(x)
Number.ro­und()
Number.to­Dou­ble()
Number.to­Int()
Number.to­Str­ing()
Number.tr­unc­ate()
Returns an int without decimal points.
 

isNan

num.isNan
True if the number is the double Not-a-­Number value; otherwise, false.

iseven

num.iseven
Returns true if the number is an even number.

hashcode

void main() {
   int n = 5000;
   print(n.hashCode);
}
syntax : num.hashcode
 

isfinite

num.isFinite

isnegative

num.is­Neg­ative
This property returns a Boolean value true if the number is a negative number.

isodd

num.isodd
Returns true if the number is an odd number.

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          More Cheat Sheets by nimakarimian

          C++ Pointers cookbook Cheat Sheet