Programmazione Dart - Metodo toInt

Questo metodo restituisce la rappresentazione intera del valore del numero.

Sintassi

Number.toInt()

Valore di ritorno

Restituisce un file int che rappresenta l'oggetto Number specificato.

Esempio

void main() { 
   double n1 = 2.0; 
   var value = n1.toInt(); 
   print("Output = ${value}"); 
}

ProdurrĂ  quanto segue output -.

Output = 2