Budget class

This class models a budget.

Implemented types
Annotations

Constructors

Budget({required String name, required Renewal renewal, required Money size, required DateTime start, required List<MoneyTransaction> transactions})
A budget.
const
Budget.fromMap(Map<String, dynamic> map)
Creates an Budget instance starting from a Map<String, dynamic> map.

Properties

hashCode int
The hash code for this object.
no setteroverride
name String
The name that identifies this budget.
final
renewal Renewal
The renewal period of this budget.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Money
The size of this budget expressed in money.
final
start DateTime
The actual start of this budget.
final
transactions List<MoneyTransaction>
The history of all the transactions related with this budget.
final

Methods

availablePercent() double
Returns the percentage of spending available for this budget.
compareTo(covariant Budget other) int
The order of the comparisons is:
override
copyWith({String? name, Renewal? renewal, Money? size, DateTime? start, List<MoneyTransaction>? transactions}) Budget
Creates a copy of this Budget instance where the only changes are those specified in the parameters of this method.
daysBetweenRenewals({DateTime? from}) int
Gets the number of days between the last renewal and the next one. In the case of monthly renewal, the value returned depends on the month in which from date is. If from is not provided, DateTime.now() date is taken, as it is for lastRenewal() and nextRenewal methods.
earned({required Currency currency, List<ExchangeRate>? exchangeRates, DateTime? from, DateTime? until}) Money
Returns the total of the incomes. These can be filtered with respect to from and until dates, or only one of these two dates, or none (in which case returns the total over the entire history of the transactions).
lastRenewal({DateTime? from}) DateTime
Returns the last renewal starting from from date. If from is not provided, DateTime.now() date is taken.
nextRenewal({DateTime? from}) DateTime
Returns the next renewal starting from from date. If from is not provided, DateTime.now() date is taken.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
spent({required Currency currency, List<ExchangeRate>? exchangeRates, DateTime? from, DateTime? until}) Money
Returns the total of the expenses. These can be filtered with respect to from and until dates, or only one of these two dates, or none (in which case returns the total over the entire history of the transactions).
toMap() Map<String, dynamic>
Creates a Map<String, dynamic> map representation of this instance.
toString() String
A string representation of this object.
inherited
transactionsCurrencies() List<Currency>
Returns all the currencies that were used in the transactions related with this budget.

Operators

operator <(covariant Budget other) bool
Returns if this instance is less than the other.
operator <=(covariant Budget other) bool
Return if this instance is less than or equal to the other.
operator ==(covariant Budget other) bool
The equality operator.
override
operator >(covariant Budget other) bool
Return if this instance is greater than the other.
operator >=(covariant Budget other) bool
Return if this instance is greater than or equal to the other.