cooler-king / quantity

A package to make it easy to work with physical quantities.
MIT License
19 stars 4 forks source link

Unable to compile #34

Closed pvaibhav closed 3 years ago

pvaibhav commented 3 years ago

I imported the package but my app fails compilation:

/usr/local/Caskroom/flutter/2.0.1/flutter/.pub-cache/hosted/pub.dartlang.org/quantity-1.0.0/lib/src/si/number_format_si.dart:34:44: Error: Superclass has no constructor named 'NumberFormat.scientificPattern'.
  NumberFormatSI({this.unicode = false}) : super.scientificPattern();
                                           ^^^^^

But the NumberFormat superclass does in fact define this named constructor.

The following is how I'm using the package. In a file analysis.dart:

import 'package:quantity/quantity_si.dart';

class ScreenSizeData {
  Length left;
  Length top;
  Length right;
  Length bottom;
  Length width;
  Length height;
  Length diagonal1;
  Length diagonal2;
}

class Measurements {
  ScreenSizeData screenSize;
}

And then in my main.dart I just have:

    Measurements m;
    m.screenSize.diagonal1 = Length.inUnits(10, inches);
    m.screenSize.diagonal2 = Length.inUnits(10, inches);
    print(m);

Any ideas what I'm doing wrong?

I'm on macOS, Flutter v2.0.1 stable.

cooler-king commented 3 years ago

The quantity package doesn't support Dart 2.12 yet. I am working on it though and may have it out as soon as this weekend.

cooler-king commented 3 years ago

quantity 2.0.0 published.

pvaibhav commented 3 years ago

thank you!!