Skip to content

[image_picker] Add the ability to pick multiple videos - platform_interface #9804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1a5afbf
I've added the `pickMultiVideo` feature to `image_picker`.
google-labs-jules[bot] Aug 6, 2025
3ac98cd
Minor cleanup (analysis, autoformat, stale comments, changelog/versio…
stuartmorgan-g Aug 7, 2025
528a6e7
Rework examples for testing and to reduce drift
stuartmorgan-g Aug 7, 2025
f2c219c
Android: Fix API version issue and add native tests
stuartmorgan-g Aug 7, 2025
47086bb
iOS: Fix, and unify some older code flows
stuartmorgan-g Aug 8, 2025
acfbfd1
Simplify iOS Dart code
stuartmorgan-g Aug 8, 2025
5dd0563
Merge branch 'main' into add-pick-multi-video
stuartmorgan-g Aug 8, 2025
100beef
Fix hero tags
stuartmorgan-g Aug 8, 2025
25f9458
Fix unguarded .first
stuartmorgan-g Aug 8, 2025
0c60fd7
Update packages/image_picker/image_picker_android/android/src/main/ja…
stuartmorgan-g Aug 8, 2025
c3040d2
Fix unit test expectation handling
stuartmorgan-g Aug 10, 2025
b5d0098
Revert part of app-facing example change
stuartmorgan-g Aug 10, 2025
21a2c50
Analysis fix
stuartmorgan-g Aug 11, 2025
9ebcff3
Fix UIImagePicker code path
stuartmorgan-g Aug 11, 2025
3c7e229
Merge branch 'main' into add-pick-multi-video-platform-interface
stuartmorgan-g Aug 14, 2025
8306374
Revert non-p-i changes
stuartmorgan-g Aug 14, 2025
c711fc3
Revert method channel changes
stuartmorgan-g Aug 14, 2025
86e96d1
Fix method name in changelog
stuartmorgan-g Aug 14, 2025
f7c6749
Add unit test
stuartmorgan-g Aug 14, 2025
59c91a9
GCAfGH review fixes
stuartmorgan-g Aug 14, 2025
886a7c4
Remove blank line
stuartmorgan-g Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.11.0

* Adds `getMultiVideoWithOptions` method.
* Updates minimum supported SDK version to Flutter 3.27/Dart 3.6.

## 2.10.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,21 @@ abstract class ImagePickerPlatform extends PlatformInterface {
return pickedImages ?? <XFile>[];
}

/// Returns a [List<XFile>] with the videos that were picked.
///
/// The videos come from the [ImageSource.gallery].
///
/// The `options` argument controls additional settings that can be used when
/// picking a video. See [MultiVideoPickerOptions] for more details.
///
/// If no videos were picked, returns an empty list.
Future<List<XFile>> getMultiVideoWithOptions({
MultiVideoPickerOptions options = const MultiVideoPickerOptions(),
}) {
throw UnimplementedError(
'getMultiVideoWithOptions() has not been implemented.');
}

/// Returns true if the implementation supports [source].
///
/// Defaults to true for the original image sources, `gallery` and `camera`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';

/// Specifies options for picking multiple videos.
@immutable
class MultiVideoPickerOptions {
/// Creates an instance with the given options.
const MultiVideoPickerOptions({
this.maxDuration,
this.limit,
});

/// The maximum duration of the picked video.
final Duration? maxDuration;

/// The maximum number of videos that can be selected.
///
/// This value may be ignored by platforms that cannot support it.
final int? limit;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export 'lost_data_response.dart';
export 'media_options.dart';
export 'media_selection_type.dart';
export 'multi_image_picker_options.dart';
export 'multi_video_picker_options.dart';
export 'picked_file/picked_file.dart';
export 'retrieve_type.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/image_picker/
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 2.10.1
version: 2.11.0

environment:
sdk: ^3.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ void main() {
fakePath);
});
});

test(
'Default implementation of getMultiVideoWithOptions should throw '
'unimplemented error', () {
final FakeCameraDelegatingImagePickerPlatform implementation =
FakeCameraDelegatingImagePickerPlatform();

expect(
() => implementation.getMultiVideoWithOptions(),
throwsUnimplementedError,
);
});
}

class FakeImagePickerPlatform extends ImagePickerPlatform {}
Expand Down