image_picker_modern 0.4.12+2

Fork of official companion plugins #

This image_picker_modern is a fork of official companion plugin image_picker with several changes/enhancements, while the maintainer commit to keep the API compatible and code up-to-date with the upstream. Just replace image_picker with image_picker_modern in the official instruction to use.

Vision:

  • Visible unit test coverage
  • Unit test for all parts (dart, ios, android)
  • Convert all plugins to Swift/Kotlin for better engagement with the community using modern languages
  • Fix cash with unit test flutter/flutter#21863 image_picker: FATAL EXCEPTION when choosing an image from downloads
  • Ultimately merged back to upstream

Image Picker plugin for Flutter #

pub package

A Flutter plugin for iOS and Android for picking images from the image library, and taking new pictures with the camera.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback welcome and Pull Requests are most welcome!

Installation #

First, add image_picker_modern as a dependency in your pubspec.yaml file.

iOS #

Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

  • NSPhotoLibraryUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Usage Description in the visual editor.
  • NSCameraUsageDescription - describe why your app needs access to the camera. This is called Privacy - Camera Usage Description in the visual editor.
  • NSMicrophoneUsageDescription - describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy - Microphone Usage Description in the visual editor.

Android #

No configuration required - the plugin should work out of the box.

Example #

import 'package:image_picker_modern/image_picker_modern.dart';

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  File _image;

  Future getImage() async {
    var image = await ImagePicker.pickImage(source: ImageSource.camera);

    setState(() {
      _image = image;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Image Picker Example'),
      ),
      body: Center(
        child: _image == null
            ? Text('No image selected.')
            : Image.file(_image),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: getImage,
        tooltip: 'Pick Image',
        child: Icon(Icons.add_a_photo),
      ),
    );
  }
}

0.4.12 #

  • Fix a crash when user tap the image mutiple times.

0.4.11 #

  • Use api to define support-v4 dependency to allow automatic version resolution.

0.4.10 #

  • Depend on full support-v4 library for ease of use (fixes conflicts with Firebase and libraries)

0.4.9 #

  • Bugfix: on iOS prevent to appear one pixel white line on resized image.

0.4.8 #

  • Replace the full com.android.support:appcompat-v7 dependency with com.android.support:support-core-utils, which results in smaller APK sizes.
  • Upgrade support library to 27.1.1

0.4.7 #

  • Added missing video_player package dev dependency.

0.4.6 #

  • Added support for picking remote images.

0.4.5 #

  • Bugfixes, code cleanup, more test coverage.

0.4.4 #

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.4.3 #

  • Bugfix: on iOS the pickVideo method will now return null when the user cancels picking a video.

0.4.2 #

  • Added support for picking videos.
  • Updated example app to show video preview.

0.4.1 #

  • Bugfix: the pickImage method will now return null when the user cancels picking the image, instead of hanging indefinitely.
  • Removed the third party library dependency for taking pictures with the camera.

0.4.0 #

  • Breaking change. The source parameter for the pickImage is now required. Also, the ImageSource.any option doesn't exist anymore.
  • Use the native Android image gallery for picking images instead of a custom UI.

0.3.1 #

  • Bugfix: Android version correctly asks for runtime camera permission when using ImageSource.camera.

0.3.0 #

  • Breaking change. Set SDK constraints to match the Flutter beta release.

0.2.1 #

  • Simplified and upgraded Android project template to Android SDK 27.
  • Updated package description.

0.2.0 #

  • Breaking change. Upgraded to Gradle 4.1 and Android Studio Gradle plugin 3.0.1. Older Flutter projects need to upgrade their Gradle setup as well in order to use this version of the plugin. Instructions can be found here.

0.1.5 #

  • Added FLT prefix to iOS types

0.1.4 #

  • Bugfix: canceling image picking threw exception.
  • Bugfix: errors in plugin state management.

0.1.3 #

  • Added optional source argument to pickImage for controlling where the image comes from.

0.1.2 #

  • Added optional maxWidth and maxHeight arguments to pickImage.

0.1.1 #

  • Updated Gradle repositories declaration to avoid the need for manual configuration in the consuming app.

0.1.0+1 #

  • Updated readme and description in pubspec.yaml

0.1.0 #

  • Updated dependencies
  • Breaking Change: You need to add a maven section with the "https://maven.google.com" endpoint to the repository section of your android/build.gradle. For example:
allprojects {
    repositories {
        jcenter()
        maven {                              // NEW
            url "https://maven.google.com"   // NEW
        }                                    // NEW
    }
}

0.0.3 #

  • Fix for crash on iPad when showing the Camera/Gallery selection dialog

0.0.2+2 #

  • Updated README

0.0.2+1 #

  • Updated README

0.0.2 #

  • Fix crash when trying to access camera on a device without camera (e.g. the Simulator)

0.0.1 #

  • Initial Release

example/README.md

image_picker_example #

Demonstrates how to use the image_picker plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  image_picker_modern: ^0.4.12+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:image_picker_modern/image_picker_modern.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
92
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
96
Learn more about scoring.

We analyzed this package on Jul 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
video_player 0.5.2

Admin