newDartException static method

Pointer<Void> newDartException(
  1. Object exception
)

Returns a new DartException.

Implementation

static Pointer<Void> newDartException(Object exception) {
  JObjectPtr? cause;
  if (exception is JObject &&
      Jni.env.IsInstanceOf(
          exception.reference.pointer, _jThrowableClass.reference.pointer)) {
    cause = exception.reference.pointer;
  }
  return Jni._bindings
      .DartException__ctor(
          Jni.env.toJStringPtr(exception.toString()), cause ?? nullptr)
      .objectPointer;
}