How to check the given value is a number or not in dart?

dart provided double.tryParse() function which will return null if the given value is not a number otherwise it returns a given number.

so based on this feature we can check given value is a Number or not by the following code.

 

 

bool _isNumeric(String result) {

    if (result == null) {

      return false;

    }

    return double.tryParse(result) != null;

  }