getFiles static method

Future<List<VPlatformFile>?> getFiles()

Implementation

static Future<List<VPlatformFile>?> getFiles() async {
  isPicking = true;
  final FilePickerResult? xFiles = await FilePicker.platform.pickFiles(
    allowMultiple: true,
  );
  isPicking = false;
  if (xFiles == null) return null;
  if (xFiles.files.isEmpty) return null;
  return xFiles.files.map((e) {
    if (e.bytes != null) {
      return VPlatformFile.fromBytes(
        name: e.name,
        bytes: e.bytes!,
      );
    }
    return VPlatformFile.fromPath(fileLocalPath: e.path!);
  }).toList();
}