asNum property

num asNum

Converts a python int or double to a dart number

Implementation

num get asNum {
  try {
    dartpyc.Py_IncRef(this);
    final d = asDouble;
    final i = asInt;
    if (d != i) {
      return d;
    } else {
      return i;
    }
  } on DartPyException catch (_) {
    throw DartPyException('Error in converting to a dart num');
  }
}