yeradis / units.dart

A starting point for measurement units in Dart
MIT License
13 stars 5 forks source link

Getter Not Found "PI" #4

Open jasonflaherty opened 4 years ago

jasonflaherty commented 4 years ago

Hello, testing this in a flutter app, and getting this error:

Compiler message:
../../.pub-cache/hosted/pub.dartlang.org/units-0.0.7/lib/src/angle.dart:10:42: Error: Getter not found: 'PI'.
    static const double _degree_to_rad = PI / 180.0;
                                         ^^
../../.pub-cache/hosted/pub.dartlang.org/units-0.0.7/lib/src/angle.dart:13:50: Error: Getter not found: 'PI'.
    static const double _rad_to_degree = 180.0 / PI;

Using your example:

var speed = new Speed.fromKilometerPerHour(value: 360.0);
        print('360 km/h are ${speed.inMeterPerSecond} m/s');
        print('360 km/h are ${speed.inMeterPerSecond} mi/h');

Originally, I was testing with Temperature: var tempC = Temperature.fromFahrenheit(value: 20.00);

Thanks :)

dodsont commented 4 years ago

@jasonflaherty i have created a fix for this. The PR is currently posted. PR #5

diego-garro commented 3 years ago

Same problem at package test, the correct code for Pi is pi. Hope correction for this issue soon. Thanks and amazing work. I use this library for a METAR (aeronautical meteorological reports) parsing package.

zachisit commented 3 years ago

Same result for me using latest version of this package. I have to remove this package and curate the calculations manually due to this bug.

diego-garro commented 3 years ago

you can copy the files and fix the bug manually at all. I had to do this because the fix never coming up by @yeradis :( . I created new files with other units too. A pull request may be an option if you like, but I don't know if @yeradis will be pending of this :/

dodsont commented 3 years ago

@diegogarromolina I already have a pull request with these changes that has been sitting waiting since May :(

diego-garro commented 3 years ago

so sad @dodsont :/