Last updated:
0 purchases
ph picker view controller
ph_picker_view_controller #
A wrapper around iOS PHPickerViewController API. (iOS 14+).
Usage #
pick #
final _plugin = PhPickerViewController();
///
/// Shows an asset picker backed by `PHPickerViewController`.
///
/// [fetchURL] fetches file URLs. By default, only asset IDs are returned.
///
/// [filter] same as `PHPickerViewController.filter`.
/// Example:
/// `{'any': ['livePhotos', 'videos']}` is equivalent to
/// `PHPickerFilter.any(of: [.livePhotos, .videos])`.
///
/// [selectionLimit] same as `PHPickerViewController.selectionLimit`.
///
/// [preferredAssetRepresentationMode] same as `PHPickerViewController.preferredAssetRepresentationMode`.
///
/// [selection] same as `PHPickerViewController.selection`.
/// [fileRepresentation] defaults to `UTType.item.identifier`. Use this to
/// specify the file representation of the picked assets.
/// For example, live photos are represented as MOV files. To get GIF files,
/// pass `public.image` instead.
await _plugin.pick(
filter: {
'any': ['livePhotos', 'videos'],
},
preferredAssetRepresentationMode: AssetRepresentationMode.current,
selection: Selection.ordered,
selectionLimit: 3,
fetchURL: true,
);
copied to clipboard
PHPickerResult:
///
/// The result type returned by [pick] function.
///
/// [id] asset ID.
/// [url] asset local URL.
/// [path] asset local path.
/// [error] error message.
class PHPickerResult {
final String id;
final String? url;
final String? error;
PHPickerResult(this.id, this.url, this.error);
}
copied to clipboard
delete #
final _plugin = PhPickerViewController();
final deleted = await _plugin.delete(
ids: ['assetID1', 'assetID2'],
);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.