getFiles method
Injects a file input with the specified accept+capture attributes, and returns a list of XFile that the user selected locally.
capture
is only supported in mobile browsers.
multiple
can be passed to allow for multiple selection of files. Defaults
to false.
Implementation
@visibleForTesting
Future<List<XFile>> getFiles({
String? accept,
String? capture,
bool multiple = false,
}) {
final web.HTMLInputElement input = createInputElement(
accept,
capture,
multiple: multiple,
);
_injectAndActivate(input);
return _getSelectedXFiles(input).whenComplete(() {
input.remove();
});
}