moneys 1.2.1 copy "moneys: ^1.2.1" to clipboard
moneys: ^1.2.1 copied to clipboard

outdated

A set of classes useful for managing money, for save in a database and retrieve from it.

Pub Version

Moneys #

A set of classes and enumerations for managing money and transactions.

Money class #

Money class is one of the pillars of this package. It has 2 properties: the amount and the currency (see the section about it).

In order to save data in a database, has the toMap() method, and to retrieve data from the database, has the fromMap(Map<String, dynamic> map) method.

This class allows the display of the value of money in a localized way. In addition, it allows viewing it with the “k” representation (for example, ‘10,000 USD’ will be write as ‘10k USD’).

So, to give an example, a Money can look like this:

Money(
    amount: 1000.15,
    currency: Currency.eur,
)

Currency enumeration #

In this enumeration are enumerated all the currencies of the world, according to ISO 4217. For each currency, it make available some properties:

  • alphabetic. This is the alphabetic representation of the currency (for example, for the US dollar it will be “USD”, always in uppercase).
  • exponent. This is the number of decimal digits that the currency’s representation requires. In the case that it does not apply, it returns null.
  • isFund. This indicates with a bool if the currency refers to a fund.
  • name. This is the complete name of the currency.
  • numeric. This is the numeric representation of the currency. These numbers have 3 digits.
  • symbol. This is symbol used for the currency.

Thanks to the StringToCurrencyX extension (on String) makes available the toCurrency() method, which allows to determine the Currency value from a string.

MoneyTransaction and MoneyTransactions classes #

The MoneyTransaction class records the date, the value, and the transaction method used. It also has a required parameter for transaction identification: id. You should guarantee its uniqueness.

MoneyTransaction is characterized according to whether it is income or expense (ExpenseOrIncome enumeration is used). The method used is specified by the value of the MoneyTransactionMethod enumeration. The frequency of renewal of a transaction is specified by the value of the Renewal enumeration.

The MoneyTransactions class makes it easy to manage the history of the transactions. It provides these features:

  • Get the entire history of transactions.
  • Add one transaction to the history.
  • Remove a transaction from the history.
  • Get all the transactions (expenses, incomes, or both) made at any given time.
  • Get all the transactions (expenses, incomes, or both) made at any given time or before.
  • Get all the transactions (expenses, incomes, or both) made at any given time or after.
  • Get all the transactions (expenses, incomes, or both) made using a certain transaction method.
  • Get all the transactions in the history with value less than (or less than or equal to) a given value.
  • Get all the transactions in the history with value greater than (or greater than or equal to) a given value.

Budget class #

Use the Budget class to manage a budget. Give it a name, specify how large it is (size), indicate what the renewal period is and from what date (start), and manage the list of Moneytransactions linked with this budget.

Also, this class, has the following methods:

  • daysBetweenRenewals(). Returns the numbers of days that there are between the last renewal and the next one, with respect to from date and time.
  • lastRenewal(). Returns the last renewal starting from from date.
  • nextRenewal(). Returns the next renewal starting from from date.
  • earned(). Returns the total of the incomes. These can be filtered with respect to from and until dates.
  • spent(). Returns the total of the expenses. These can be filtered with respect to from and until dates.
9
likes
0
pub points
25%
popularity

Publisher

unverified uploader

A set of classes useful for managing money, for save in a database and retrieve from it.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, geos, google_maps_flutter, intl, pedantic

More

Packages that depend on moneys