Show Menu
Cheatography

Dart numbers Cheat Sheet by

view Dart vs C++ in advance

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.

isinfinite

num.isinfinite

sign

num.sign
Returns minus one, zero or plus one depending on the sign and numerical value of the 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.
 

hashcode

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

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.
 

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.
 

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.

          Related Cheat Sheets

          Dart Datatypes (List - Map - Set - Queues - Enums) Cheat Sheet

          More Cheat Sheets by nimakarimian

          C++ Pointers cookbook Cheat Sheet