API Reference 0.5.1+4rikulo_cameraCamera

Camera class

Access to the camera application of this device.

class Camera {
 js.Proxy _camera;

 factory Camera() => camera;

 Camera._internal() {
   if (device == null)
     throw new StateError('device is not ready yet.');
   js.scoped(() {
     _camera = js.context.navigator.camera;
     js.retain(_camera);
   });
 }

 /**
 * Takes a photo using the camera or retrieves a photo from the device's
 * album based on the cameraOptoins paremeter. Returns the image as a
 * base64 encoded String or as the URI of an image file.
 */
 void getPicture(CameraSuccessCB success,
     CameraErrorCB error, [CameraOptions options]) {
   js.scoped(() {
     var jsfns = JSUtil.newCallbackOnceGroup("cam", [success, error], [1, 1]);
     var ok = jsfns[0];
     var fail = jsfns[1];
     var opts = options == null ? null : js.map(options._toMap());
     _camera.getPicture(ok, fail, opts);
   });
 }

 /**
  * Cleans up the image files stored in temporary storage that were taken by
  * the method [getPicture] when the [CameraOptions.sourceType] is set to
  * [PictureSourceType.CAMERA] and [CameraOptions.destinationType] is set
  * to [DestinationType.FILE_URI].
  */
 void cleanup(CleanupSuccessCB success, CameraErrorCB error) {
   js.scoped(() {
     var jsfns = JSUtil.newCallbackOnceGroup("cam", [success, error], [0, 1]);
     var ok = jsfns[0];
     var fail = jsfns[1];
     _camera.cleanup(ok, fail);
   });
 }
}

Constructors

factory Camera() #

factory Camera() => camera;

Methods

void cleanup(CleanupSuccessCB success, CameraErrorCB error) #

Cleans up the image files stored in temporary storage that were taken by the method getPicture when the CameraOptions.sourceType is set to PictureSourceType.CAMERA and CameraOptions.destinationType is set to DestinationType.FILE_URI.

void cleanup(CleanupSuccessCB success, CameraErrorCB error) {
 js.scoped(() {
   var jsfns = JSUtil.newCallbackOnceGroup("cam", [success, error], [0, 1]);
   var ok = jsfns[0];
   var fail = jsfns[1];
   _camera.cleanup(ok, fail);
 });
}

void getPicture(CameraSuccessCB success, CameraErrorCB error, [CameraOptions options]) #

Takes a photo using the camera or retrieves a photo from the device's album based on the cameraOptoins paremeter. Returns the image as a base64 encoded String or as the URI of an image file.

void getPicture(CameraSuccessCB success,
   CameraErrorCB error, [CameraOptions options]) {
 js.scoped(() {
   var jsfns = JSUtil.newCallbackOnceGroup("cam", [success, error], [1, 1]);
   var ok = jsfns[0];
   var fail = jsfns[1];
   var opts = options == null ? null : js.map(options._toMap());
   _camera.getPicture(ok, fail, opts);
 });
}