getRectangle method Null safety

Rectangle getRectangle()

Get a face bounding rectangle.

Implementation

Rectangle getRectangle(){
  var exception = _getException();
  final get_rect = _dll_handle.lookupFunction<_RSgetRectangle_c, _RSgetRectangle_dart>
    (_c_namespace + 'RawSample_getRectangle');

  Pointer<Int32> w = malloc.allocate(sizeOf<Pointer<Int32>>());
  Pointer<Int32> h = malloc.allocate(sizeOf<Pointer<Int32>>());
  Pointer<Int32> x = malloc.allocate(sizeOf<Pointer<Int32>>());
  Pointer<Int32> y = malloc.allocate(sizeOf<Pointer<Int32>>());


  get_rect(_impl, x, y, w, h, exception);

  checkException(exception, _dll_handle);

  Rectangle rect = Rectangle(x.value, y.value, w.value, h.value);

  malloc.free(w);
  malloc.free(h);
  malloc.free(x);
  malloc.free(y);

  return rect;
}