Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker] Switch Android to internal method channel #5958

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Add Dart registration and test
  • Loading branch information
stuartmorgan-g committed Jun 10, 2022
commit 18c61759364e54549c89bef71e27e6fd2bd25695
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class ImagePickerAndroid extends ImagePickerPlatform {
@visibleForTesting
MethodChannel get channel => _channel;

/// Registers this class as the default platform implementation.
static void registerWith() {
ImagePickerPlatform.instance = ImagePickerAndroid();
}

@override
Future<PickedFile?> pickImage({
required ImageSource source,
Expand Down
1 change: 1 addition & 0 deletions packages/image_picker/image_picker_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ flutter:
android:
package: io.flutter.plugins.imagepicker
pluginClass: ImagePickerPlugin
dartPLuginClass: ImagePickerAndroid

dependencies:
flutter:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ void main() {
log.clear();
});

test('registers instance', () async {
ImagePickerAndroid.registerWith();
expect(ImagePickerPlatform.instance, isA<ImagePickerAndroid>());
});

group('#pickImage', () {
test('passes the image source argument correctly', () async {
await picker.pickImage(source: ImageSource.camera);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy