showPicker method
Opens the media picker and returns a list of selected media files.
If the user grants permission, it displays a bottom sheet grid to select images or videos.
Returns a list of MediaViewModel
if media is selected, otherwise null
.
Implementation
Future<List<String>> showPicker() async {
if (context.mounted) {
if (kIsWeb) {
return await WebImplementation(mediaType: mediaType, maxLimit: maxLimit)
.pickMultipleImages() ??
[];
} else {
if (Platform.isIOS && mediaType == MediaType.audio) {
throw "Audio picking is not supported for ios , You can use picFile () by passing MediaType.audio";
}
return showGridBottomSheet(context, maxLimit, mediaType, cancelText,
doneText, moreText, emptyText, openSettingText);
}
}
return [];
}