computeCaptureAttribute method

  1. @visibleForTesting
String? computeCaptureAttribute(
  1. ImageSource source,
  2. CameraDevice device
)

Converts plugin configuration into a proper value for the capture attribute.

See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#capture

Implementation

@visibleForTesting
String? computeCaptureAttribute(ImageSource source, CameraDevice device) {
  if (source == ImageSource.camera) {
    return (device == CameraDevice.front) ? 'user' : 'environment';
  }
  return null;
}