pickFile static method

Future<XFile?> pickFile({
  1. List<String>? allowedExtensions,
})

Implementation

static Future<XFile?> pickFile({
  List<String>? allowedExtensions,
}) async {
  FilePickerResult? result = await FilePicker.platform.pickFiles(allowedExtensions: allowedExtensions);

  if (result != null) {
    XFile file = XFile(result.files.single.path!);
    return file;
  }
  return null;
}