createInputElement method

  1. @visibleForTesting
Element createInputElement(
  1. String? accept,
  2. String? capture, {
  3. bool multiple = false,
})

Creates an input element that accepts certain file types, and allows to capture from the device's cameras (where supported)

Implementation

@visibleForTesting
html.Element createInputElement(
  String? accept,
  String? capture, {
  bool multiple = false,
}) {
  if (_hasOverrides) {
    return _overrides!.createInputElement(accept, capture);
  }

  html.Element element = html.FileUploadInputElement()
    ..accept = accept
    ..multiple = multiple;

  if (capture != null) {
    element.setAttribute('capture', capture);
  }

  return element;
}