pickFile method

  1. @visibleForTesting
Future<PickedFile> pickFile({
  1. String? accept,
  2. String? capture,
})

Injects a file input with the specified accept+capture attributes, and returns the PickedFile that the user selected locally.

capture is only supported in mobile browsers. See https://caniuse.com/#feat=html-media-capture

Implementation

@visibleForTesting
Future<PickedFile> pickFile({
  String? accept,
  String? capture,
}) {
  html.FileUploadInputElement input =
      createInputElement(accept, capture) as html.FileUploadInputElement;
  _injectAndActivate(input);
  return _getSelectedFile(input);
}