pyConvertBackNum function Null safety

num pyConvertBackNum (
  1. Pointer<PyObject> o
)

Converts a python int or double to a dart number

Implementation

num pyConvertBackNum(Pointer<PyObject> o) {
  try {
    dartpyc.Py_IncRef(o);
    final d = pyConvertBackDouble(o);
    final i = pyConvertBackInt(o);
    if (d != i) {
      return d;
    } else {
      return i;
    }
  } on DartPyException catch (_) {
    throw DartPyException('Error in converting back to a num');
  }
}