pickFiles static method

Future<List<KatPlatformFile>> pickFiles({
  1. bool allowMultiple = false,
  2. KatFileType type = KatFileType.any,
})

hàm này dùng để mở picker chọn file từ thiết bị

file_picker: ^12.0.0 removed the old FilePicker.platform / FilePickerResult / withData / withReadStream API - pickFiles now lives directly on FilePicker and always returns List<PlatformFile>, with bytes read lazily via PlatformFile.readAsBytes(). allowMultiple is also deprecated there in favor of a separate single-file pickFile, so that's what we call when allowMultiple is false.

Implementation

static Future<List<KatPlatformFile>> pickFiles({
  bool allowMultiple = false,
  KatFileType type = KatFileType.any,
}) async {
  if (!allowMultiple) {
    final file = await FilePicker.pickFile(type: type);
    return file == null ? [] : [file];
  }
  return FilePicker.pickFiles(type: type);
}