Dart Documentationutils.dart

utils.dart library

Functions

double tryParseDouble(String text) #

Tries to parse an double from a string.

The function returns if possible the duble value of the string. If the string is not an double it returns null.

double tryParseDouble(String text)
{
 double result;
 try 
 {
   result = double.parse(text);
 } 
 on Exception 
 {
   result = null;
 }
 return result;
}

int tryParseInt(String text) #

Tries to parse an integer from a string.

The function returns if possible the integer value of the string. If the string is not an integer it returns null.

int tryParseInt(String text)
{
 int result;
 try 
 {
   result = int.parse(text);
 } 
 on Exception 
 {
   result =  null;
 }
 return result;
}