Gini class final
A class that represents a Gini coefficient.
The Gini class is a simple value object that represents a Gini coefficient. It consists of an int value that represents the year of the Gini coefficient, and a double value that represents the value of the Gini coefficient. The year field must be greater than 1990, and the coefficient field must be between 0.0 and 100.0 (inclusive). Reference - https://wikipedia.org/wiki/Gini_coefficient.
Example usage:
final gini = Gini(year: 2020, coefficient: 32.0);
print(gini.year); // Prints: 2020
print(gini.coefficient); // Prints: 32.0
- Implemented types
- Available extensions
Constructors
Properties
- coefficient → double
-
The value of this Gini coefficient.
final
- dateTime → DateTime
-
Available on Gini, provided by the GiniExtension extension
Converts the year field of this Gini object to a DateTime object.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- year → int
-
The year of this Gini coefficient.
final
Methods
-
copyWith(
{int? year, double? coefficient}) → Gini -
Available on Gini, provided by the GiniExtension extension
Creates a copy of this object with the given fields replaced with the new values. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
{JsonCodec codec = const JsonCodec()}) → String -
Returns a JSON-encoded string representation of the object.
override
-
toMap(
) → Map< String, num> -
Available on Gini, provided by the GiniExtension extension
Converts this object object to a JSON like map. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
covariant Gini other) → bool -
The equality operator.
override
Constants
- maxCoefficient → const double
- The maximum value that can be used as the coefficient parameter when creating a Gini object.
- minCoefficient → const double
- The minimum value that can be used as the coefficient parameter when creating a Gini object.
- minYear → const int
- The minimum year that can be used as the year parameter when creating a Gini object.