CaiJingLong / dart_image_size_getter

Use dart file api to get image size, needn't use decode. just read the metadata.
Apache License 2.0
64 stars 29 forks source link

[Feature request] Replace your `Size` with some child of ui.Size #31

Open bambinoua opened 1 year ago

bambinoua commented 1 year ago

Platforms

dart

Description

Now your Size interfere with dart:ui Size. It would be good to have your own class. For example:

class ImageSize extends Size {
  ...
}

Why

It will not confuses the user because Size is just a base object with width and height. You bring your own sense - it is image size (moreover with the additional boolean).

CaiJingLong commented 1 year ago

This problem occurs in actual use, mainly because Dart does not provide Size. Size is defined in dart:ui in flutter, which is flutter only.

import 'package:image_size_getter/image_size_getter.dart' as getter;

foo(getter.ImageInput input) {
  getter.Size size = getter.ImageSizeGetter.getSize(input);

  print(size);
}
import 'package:image_size_getter/image_size_getter.dart' hide Size;

foo(ImageInput input) {
  final size = ImageSizeGetter.getSize(input);

  print(size);
}

I'll modify the class name of Size next major version.