diff --git a/lib/src/widgets/toolbar/image_video_utils.dart b/lib/src/widgets/toolbar/image_video_utils.dart index dd3a4859..0305378b 100644 --- a/lib/src/widgets/toolbar/image_video_utils.dart +++ b/lib/src/widgets/toolbar/image_video_utils.dart @@ -60,7 +60,7 @@ class ImageVideoUtils { 'Please provide webImagePickImpl for Web ' '(check out example directory for how to do it)'); imageUrl = await webImagePickImpl!(onImagePickCallback); - } else if (Platform.isAndroid || Platform.isIOS) { + } else if (_isMobile()) { imageUrl = await _pickImage(imageSource, onImagePickCallback); } else { assert(filePickImpl != null, 'Desktop must provide filePickImpl'); @@ -112,7 +112,7 @@ class ImageVideoUtils { 'Please provide webVideoPickImpl for Web ' '(check out example directory for how to do it)'); videoUrl = await webVideoPickImpl!(onVideoPickCallback); - } else if (Platform.isAndroid || Platform.isIOS) { + } else if (_isMobile()) { videoUrl = await _pickVideo(videoSource, onVideoPickCallback); } else { assert(filePickImpl != null, 'Desktop must provide filePickImpl'); @@ -125,6 +125,8 @@ class ImageVideoUtils { } } + static bool _isMobile() => Platform.isAndroid || Platform.isIOS; + static Future _pickVideo( ImageSource source, OnVideoPickCallback onVideoPickCallback) async { final pickedFile = await ImagePicker().pickVideo(source: source);