Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4b3c599
Migrate image picker platform interface to cross_file
BeMacized Jun 21, 2021
c4c5de4
[image_picker] Implemented changes for cross_file migration
BeMacized Jun 21, 2021
44aa4c5
[image_picker] migrated web implementation to cross_file
BeMacized Jun 22, 2021
e39fa1f
Reverted changes to web implementation to move to separate PR
BeMacized Jun 23, 2021
f4fbd0c
[image_picker_for_web] Migration to cross_file
BeMacized Jun 23, 2021
2de19b4
Merge branch 'master' into issue/70886
BeMacized Jun 30, 2021
86f604b
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jun 30, 2021
7b39862
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jun 30, 2021
68e2ef8
Re-added old methods and marked them as deprecated.
BeMacized Jun 30, 2021
d345b37
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jun 30, 2021
a0ab00e
Update to match platform interface changes
BeMacized Jun 30, 2021
875704e
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jun 30, 2021
a987170
Format & annotate deprecated classes.
BeMacized Jun 30, 2021
6ab2bb0
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jun 30, 2021
5900446
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jun 30, 2021
217949d
Updated to match platform interface changes
BeMacized Jun 30, 2021
3fa10b9
Updated pubspec and changelog.
BeMacized Jun 30, 2021
c1ff8b2
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jun 30, 2021
addfe99
Updated platform interface dependency version
BeMacized Jun 30, 2021
6d329e6
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jun 30, 2021
aefff73
Updated changelog and pubspec version
BeMacized Jun 30, 2021
f5a4163
Updated pubspec version and changelog
BeMacized Jun 30, 2021
2c4cd91
Fix analysis issues for deprecations
BeMacized Jul 2, 2021
69969b2
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jul 2, 2021
129efcb
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jul 2, 2021
29e0c40
Remove Deprecation tags so we don't break consumers of this package o…
ditman Jul 8, 2021
c74cebb
Merge branch 'master' into issue/70886
ditman Jul 8, 2021
0a082c8
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jul 8, 2021
043db42
Merge branch 'issue/70886' into issue/70886-impl-android-ios
BeMacized Jul 8, 2021
4615db1
Temporary platform interface reference dependency
BeMacized Jul 8, 2021
d3662f6
Merge branch 'issue/70886-impl-web' into issue/70886-impl-android-ios
BeMacized Jul 8, 2021
84ee0a2
Temporary dependency update
BeMacized Jul 8, 2021
faa1a99
Implement PR feedback
BeMacized Jul 8, 2021
afa61ab
Merge branch 'issue/70886' into issue/70886-impl-web
BeMacized Jul 8, 2021
b29ec7f
Merge branch 'issue/70886-impl-web' into issue/70886-impl-android-ios
BeMacized Jul 8, 2021
756633b
Update platform interface and web implementation dependency references
BeMacized Jul 13, 2021
c1131d5
Merge branch 'master' into issue/70886-impl-android-ios
BeMacized Jul 13, 2021
c7fd236
Update documentation
BeMacized Jul 13, 2021
8c89c99
Fix merge issues
BeMacized Jul 13, 2021
8073e7a
Fix merge issues
BeMacized Jul 13, 2021
bda48dd
Move tests of deprecated methods to new file, and ignore warnings the…
ditman Jul 14, 2021
a9534fe
Update Changelog to mention the deprecation of the current methods, a…
ditman Jul 14, 2021
e59bb03
Remove unnecessary ignore_for_file from plugin code.
ditman Jul 14, 2021
dc0e7eb
Merge branch 'master' into issue/70886-impl-android-ios
ditman Jul 16, 2021
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,3 +1,11 @@
## 3.0.0

* Breaking changes:
* pickImage now returns XFile instead of PickedFile
* pickVideo now returns XFile instead of PickedFile
* changed LostData file parameter type to XFile
* removed PickedFile class and its tests

## 2.1.0

* Add `pickMultiImage` method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

export 'package:image_picker_platform_interface/src/platform_interface/image_picker_platform.dart';
export 'package:image_picker_platform_interface/src/types/types.dart';
export 'package:cross_file/cross_file.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:image_picker_platform_interface/src/types/lost_data.dart';
import 'package:meta/meta.dart' show visibleForTesting;

import 'package:image_picker_platform_interface/image_picker_platform_interface.dart';
Expand All @@ -19,7 +20,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
MethodChannel get channel => _channel;

@override
Future<PickedFile?> pickImage({
Future<XFile?> pickImage({
required ImageSource source,
double? maxWidth,
double? maxHeight,
Expand All @@ -33,11 +34,11 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
imageQuality: imageQuality,
preferredCameraDevice: preferredCameraDevice,
);
return path != null ? PickedFile(path) : null;
return path != null ? XFile(path) : null;
}

@override
Future<List<PickedFile>?> pickMultiImage({
Future<List<XFile>?> pickMultiImage({
double? maxWidth,
double? maxHeight,
int? imageQuality,
Expand All @@ -49,9 +50,9 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
);
if (paths == null) return null;

final List<PickedFile> files = [];
final List<XFile> files = [];
for (final path in paths) {
files.add(PickedFile(path));
files.add(XFile(path));
}
return files;
}
Expand Down Expand Up @@ -117,7 +118,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
}

@override
Future<PickedFile?> pickVideo({
Future<XFile?> pickVideo({
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
Expand All @@ -127,7 +128,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
maxDuration: maxDuration,
preferredCameraDevice: preferredCameraDevice,
);
return path != null ? PickedFile(path) : null;
return path != null ? XFile(path) : null;
}

Future<String?> _pickVideoPath({
Expand Down Expand Up @@ -175,7 +176,7 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
final String? path = result['path'];

return LostData(
file: path != null ? PickedFile(path) : null,
file: path != null ? XFile(path) : null,
exception: exception,
type: retrieveType,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// found in the LICENSE file.

import 'dart:async';
import 'package:cross_file/cross_file.dart';
import 'package:image_picker_platform_interface/src/types/lost_data.dart';

import 'package:plugin_platform_interface/plugin_platform_interface.dart';

Expand Down Expand Up @@ -40,7 +42,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {

// Next version of the API.

/// Returns a [PickedFile] with the image that was picked.
/// Returns a [XFile] with the image that was picked.
///
/// The `source` argument controls where the image comes from. This can
/// be either [ImageSource.camera] or [ImageSource.gallery].
Expand Down Expand Up @@ -68,7 +70,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
///
/// If no images were picked, the return value is null.
Future<PickedFile?> pickImage({
Future<XFile?> pickImage({
required ImageSource source,
double? maxWidth,
double? maxHeight,
Expand All @@ -78,7 +80,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
throw UnimplementedError('pickImage() has not been implemented.');
}

/// Returns a [List<PickedFile>] with the images that were picked.
/// Returns a [List<XFile>] with the images that were picked.
///
/// The images come from the [ImageSource.gallery].
///
Expand All @@ -96,15 +98,15 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// a warning message will be logged.
///
/// If no images were picked, the return value is null.
Future<List<PickedFile>?> pickMultiImage({
Future<List<XFile>?> pickMultiImage({
double? maxWidth,
double? maxHeight,
int? imageQuality,
}) {
throw UnimplementedError('pickMultiImage() has not been implemented.');
}

/// Returns a [PickedFile] containing the video that was picked.
/// Returns a [XFile] containing the video that was picked.
///
/// The [source] argument controls where the video comes from. This can
/// be either [ImageSource.camera] or [ImageSource.gallery].
Expand All @@ -120,15 +122,15 @@ abstract class ImagePickerPlatform extends PlatformInterface {
/// in this call. You can then call [retrieveLostData] when your app relaunches to retrieve the lost data.
///
/// If no images were picked, the return value is null.
Future<PickedFile?> pickVideo({
Future<XFile?> pickVideo({
required ImageSource source,
CameraDevice preferredCameraDevice = CameraDevice.rear,
Duration? maxDuration,
}) {
throw UnimplementedError('pickVideo() has not been implemented.');
}

/// Retrieve the lost [PickedFile] file when [pickImage] or [pickVideo] failed because the MainActivity is destroyed. (Android only)
/// Retrieve the lost [XFile] file when [pickImage] or [pickVideo] failed because the MainActivity is destroyed. (Android only)
///
/// Image or video can be lost if the MainActivity is destroyed. And there is no guarantee that the MainActivity is always alive.
/// Call this method to retrieve the lost data and process the data according to your APP's business logic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:cross_file/cross_file.dart';
import 'package:flutter/services.dart';
import 'package:image_picker_platform_interface/src/types/types.dart';

Expand Down Expand Up @@ -31,7 +32,7 @@ class LostData {
/// The file that was lost in a previous [pickImage] or [pickVideo] call due to MainActivity being destroyed.
///
/// Can be null if [exception] exists.
final PickedFile? file;
final XFile? file;

/// The exception of the last [pickImage] or [pickVideo].
///
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export 'camera_device.dart';
export 'image_source.dart';
export 'retrieve_type.dart';
export 'picked_file/picked_file.dart';
export 'lost_data.dart';

/// Denotes that an image is being picked.
const String kTypeImage = 'image';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/plugins/tree/master/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.1.0
version: 3.0.0

environment:
sdk: ">=2.12.0 <3.0.0"
Expand All @@ -16,6 +16,7 @@ dependencies:
http: ^0.13.0
meta: ^1.3.0
plugin_platform_interface: ^2.0.0
cross_file: ^0.3.1+1

dev_dependencies:
flutter_test:
Expand Down
Loading