pickFiles method

  1. @override
Future<List<PickedFile>?> pickFiles(
  1. FilePickerOptions options
)
override

Picks files from the device storage based on the provided options.

Platform implementations should override this method to handle file picking on their respective platforms.

Implementation

@override
Future<List<PickedFile>?> pickFiles(FilePickerOptions options) async {
  try {
    final result = await methodChannel.invokeMethod<List<dynamic>>(
      'pickFiles',
      options.toMap(),
    );

    if (result == null) return null;

    return result
        .map(
          (file) =>
              PickedFile.fromMap(Map<String, dynamic>.from(file as Map)),
        )
        .toList();
  } on PlatformException {
    return null;
  }
}