pit_gallery_count 0.1.2+4

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

PIT Gallery Count #

Use this Plugin for count a image in gallery

Note: This plugin is still under development, and some Components might not be available yet or still has so many bugs.

Installation #

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

pit_gallery_count: ^0.1.2+4

Important #

this plugin depends on other plugins, you must have a permission to use this plugin, you can use pit_permission plugin or other permission plugin.

You must add this permission in AndroidManifest.xml for Android

for read Storage = <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
for write Storage = <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Note: version ^0.1.1 doesn't support for IOS

And you must add this on info.plist for IOS

For read storage #

 <string>${PRODUCT_NAME} Need To Access Your Photo</string>
     int galleryCount = await PitGalleryCount.getGalleryCount();

Example for Get Image List #

Note work on version <= 0.1.1

   List<ImageData> params = [ImageData.imageName, ImageData.dateTaken, ImageData.imageSize];
   List<dynamic> res = await PitGalleryCount.getImageList(imageData: params);

Note work on version 0.1.2

    List<GalleryWithUint8List> res = await PitGalleryCount.getImageListWithByteData(countImage: 2, imageSortBy: SortColumn.dateTaken, maxSize: 200);

0.1.2+4 #

upgrade pathprovider to 1.3.0 , and fix bugs

0.1.2+3 #

  • fix bug if images not available

0.1.2+2 #

  • downgrade pathprovider to 0.5.0+1

0.1.2+1 #

  • fix on logic to completed

0.1.2 #

  • added byteData on model and can be convert to file

0.1.1 #

  • ios result not implement, return model on android

0.1.0+1 #

  • Get a method to get Image List in ios

0.1.0 #

  • Get a method to get Image List

0.0.1 #

  • TODO: Describe initial release.


example/README.md #

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:pit_gallery_count/pit_gallery_count.dart';
import 'dart:io';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  int _galleryCount = 0;

  List<GalleryWithUint8List> imageList;
  List<File> result;

  void initState() {

  Future<void> getTotalImage() async {
    int galleryCount;
    List<GalleryWithUint8List> res;
    List<File> fileList = [];

    try {
      galleryCount = await PitGalleryCount.getGalleryCount();
      res = await PitGalleryCount.getImageListWithByteData(
          countImage: 2, imageSortBy: SortColumn.dateTaken, maxSize: 200);

      for (var item in res) {
        fileList.add(await PitGalleryCount.convertByteDataToFile(item.dataByteImage));
    } on PlatformException {
      galleryCount = -1;

    if (!mounted) return;

    setState(() {
      _galleryCount = galleryCount;
      imageList = res;
      result = fileList;

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          body: Column(
            children: <Widget>[
              Text("Total Image on device :${_galleryCount}\n\n"),
                  onPressed: () async {
                    await PitGalleryCount.clearTempFile();
                  child: Text("text")),
                  child: result == null
                      ? Container(color: Colors.black)
                      : SingleChildScrollView(
                          child: Column(
                          children: List.generate(result.length, (index) {
                            return Image.file(result[index]);

Use this package as a library

1. Depend on it

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

  pit_gallery_count: ^0.1.2+4

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:pit_gallery_count/pit_gallery_count.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health issues and suggestions

Document public APIs. (-1 points)

36 out of 36 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/pit_gallery_count.dart. (-1.49 points)

Analysis of lib/pit_gallery_count.dart reported 3 hints:

line 48 col 5: 'defaultBinaryMessenger' is deprecated and shouldn't be used. Use ServicesBinding.instance.defaultBinaryMessenger instead. This feature was deprecated after v1.6.5..

line 48 col 76: This function has a return type of 'Future

line 50 col 7: 'defaultBinaryMessenger' is deprecated and shouldn't be used. Use ServicesBinding.instance.defaultBinaryMessenger instead. This feature was deprecated after v1.6.5..


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
path_provider ^1.3.0 1.5.1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
platform 2.2.1
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8