pick static method

Future<XPickedFile?> pick({
  1. List<String>? mimeTypes,
})

Present the system file picker. Returns the picked file's local-disk path (and optional metadata), or null if the user cancelled.

File content is never marshalled across the platform channel — the native side only ships back the path. Use dart:io to read the file: File(picked.path).openRead() etc.

mimeTypes filters the picker. Each entry can be a concrete type (image/png), a wildcard (image/*), or */*. Null = [*/*]. Note: Apple platforms map MIME → UTType internally; common types (image/*, video/*, application/pdf) work on all three. For Apple-specific types prefer concrete MIME like image/jpeg over wildcards. Windows filters by extension: image/* and video/* allow the image and video files the app handles there, and a type whose extensions Windows does not know allows every file.

Implementation

static Future<XPickedFile?> pick({List<String>? mimeTypes}) async {
  final result = await _channel.invokeMapMethod<String, Object?>('pick', {
    'mimeTypes': ?mimeTypes,
  });
  if (result == null) return null;
  return _pickedFile(result);
}