image_size_getter 0.1.0

  • Readme
  • Changelog
  • Installing
  • 82

image_size_getter #

Do not completely decode the image file, just read the metadata to get the image width and height.

Just support jpeg, git, png, webp.

Usage #

import 'dart:io';

import 'package:image_size_getter/image_size_getter.dart';

main(List<String> arguments) async {
  File file = File("asset/IMG_20180908_080245.jpg");
  final size = ImageSizGetter.getSize(file);
  print("jpg = $size");

  File pngFile = File("asset/ic_launcher.png");
  final pngSize = ImageSizGetter.getSize(pngFile);
  print("png = $pngSize");

  File webpFile = File("asset/demo.webp");
  final webpSize = ImageSizGetter.getSize(webpFile);
  print("webp = $webpSize");

  File gifFile = File("asset/dialog.gif");
  final gifSize = ImageSizGetter.getSize(gifFile);
  print("gif = $gifSize");

0.1.0 #

Initial version.

Use this package as a library

1. Depend on it

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

  image_size_getter: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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_size_getter/image_size_getter.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 Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

15 out of 15 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.

Format lib/image_size_getter.dart.

Run dartfmt to format lib/image_size_getter.dart.

Format lib/src/utils/file_utils.dart.

Run dartfmt to format lib/src/utils/file_utils.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and image_size_getter.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
collection ^1.14.12 1.14.12
Dev dependencies
pedantic ^1.7.0
test ^1.5.0