A library to easily convert between units of different system.
In the dependencies:
section of your pubspec.yaml
, add the following line:
unit_converter: <latest_version>
If you want to convert area units, get an instance of area converter, and call the convert
method:
import 'package:unit_converter/unit_converter.dart';
main() {
var areaConverter = getConverter(Converter.area);
areaConverter.convert(value: 2, from: AreaUnit.acre, to: AreaUnit.squareFoot);
}
Get the available units:
var avilableUnits = areaConverter.units();
Each unit have a name
(British spelling) and an americanName
(American spelling) property. For units that have the same americanName
as name
, the americanName
is null. So, it is always good to check for the availability of americanName
before displaying it.
for(var unit in avilableUnits) {
if(unit.americanName != null) {
print(unit.americanName);
} else {
print(unit.name);
}
}
This project needs you! If you would like to support the creator of this project or the continuous development and maintenance of this project, feel free to donate. Your donation is highly appreciated. Thank you!
PayPal
- Donate $5: Thank's for creating this project, here's a tea (or some juice) for you!
- Donate $10: Wow, I am amazed. Let me take you to the movies!
- Donate $15: I really appreciate your work, let's grab some lunch!
- Donate $25: That's some awesome stuff you did right there, dinner is on me!
- Donate $50: I really really want to support this project, great job!
- Donate $100: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
- Donate $2799: Go buddy, buy Macbook Pro for yourself!
Of course, you can also choose what you want to donate, all donations are awesome!
Please file feature requests and bugs at the issue tracker.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request