geo_currencies 0.0.2
geo_currencies: ^0.0.2 copied to clipboard
Package to get information about currency used in some country
GeoCurrencies #
Flutter Package that provides methods for fetching currencies information.
Features #
- get currency data by coordinate: The library provides methods to get currency data of a given geographic coordinate.
- format amount with currency: The library provides methods to easily format amount with currency symbol.
- Address suggestions: The library provides methods to get address suggestions for a given address.
- Support for multiple languages: The methods accept an optional Locale parameter, which can be used to specify the language. The default language is English.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
geo-currencies: <lastest>
Usage #
The GeocurrenciesInterface class is implemented as a interface, with a factory constructor that returns different instance by optional GeoCurrenciesType given, by default the GeoCurrenciesType is live.
For some tests in your code your can do:
GeoCurrenciesInterface geoCurrencies = GeoCurrenciesInterface(GeoCurrenciesType.fake);
For live implementation in your code your can do:
GeoCurrenciesInterface geoCurrencies = GeoCurrenciesInterface(GeoCurrenciesType.live);
Or
GeoCurrenciesInterface geoCurrencies = GeoCurrenciesInterface();
getCurrencyDataByCoordinate #
CurrencyData? currencyData = await geoCurrencies.getCurrencyDataByCoordinate(
latitude: 37.4219999,
longitude: 32.0840575,
);
formatAmountWithCurrencySymbol #
String amountToDisplay = geoCurrencies.formatAmountWithCurrencySymbol(
amount: 10,
currencyCodeAlpha3: 'USD',
locale: const Locale('en','US')
);
Responses #
CurrencyData is a class that represents a currency and its details. It has the following attributes:
| Attribute | Type | Description |
|---|---|---|
| codeAlpha3 | String | represents the currency code in form alpha 3. |
| name | String | represents the currency name. |
| countryName | String | represents the country where the currency is used. |
| symbol | String | represents the symbol of the currency. |
Dependencies #
http: ^1.1.0
intl: ^0.19.1
logging: ^1.0.2