EmpireNullableDoubleProperty class

An EmpireProperty with similar characteristics of dart double objects

The underlying value can be null.

If the underlying value of this is null and an arithmetic operator is called on this, it will throw a EmpirePropertyNullValueException.

You can easily check for null by accessing the isNull or isNotNull properties.

When the value of this changes, it will send a EmpireStateChanged event by default. This includes automatically triggering a UI rebuild.

Example

final percentage = EmpireNullableDoubleProperty(10.0);

if (percentage.isNull)
{
   print("I'm Null");
}

Other Usages Examples


final percentage = EmpireNullableDoubleProperty();

print('${percentage.add(5.2)}'); //throws EmpireNullValueException because no value has been set yet.

percentage(10.0)

print('${percentage.subtract(0.5)}'); //prints 9.5

Inheritance

Constructors

EmpireNullableDoubleProperty({double? value, String? propertyName})
EmpireNullableDoubleProperty.zero({String? propertyName})
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isNegative bool
Whether this number is negative.
no setter
isNotNull bool
Returns true if the value of this is not null.
no setterinherited
isNull bool
Returns true if the value of this is null.
no setterinherited
originalValue double?
no setterinherited
propertyName String?
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value double?
no setterinherited
viewModel EmpireViewModel
Returns the instance of the EmpireViewModel this property is associated with.
no setterinherited

Methods

add<E extends num>(E other) double
Adds other to this number.
call(double? value, {bool notifyChange = true, bool setAsOriginal = false}) → void
Updates the underlying value for this EmpireProperty.
inherited
divide<E extends num>(E other) double
Divides this number by other.
equals(dynamic other) bool
Checks if other is equal to the value of this EmpireProperty
inherited
mod<E extends num>(E other) double
Euclidean modulo of this number by other.
multiply<E extends num>(E other) double
Multiplies this number by other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset({bool notifyChange = true}) → void
Resets the value to the originalValue.
inherited
round() int?
Returns the integer closest to the double value.
roundToDouble() double?
Returns the integer double value closest to the double value.
set(double? value, {bool notifyChange = true, bool setAsOriginal = false}) double?
Updates the property value. Notifies any listeners to the change
inherited
setOriginalValueToCurrent() → void
Updates the original value to what the current value of this property is.
inherited
setViewModel(EmpireViewModel viewModel) → void
Links this EmpireProperty instance with an EmpireViewModel.
inherited
subtract<E extends num>(E other) double
Subtracts other from this number.
toInt() int?
Truncates the double value and returns the int
toString() String
A string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator.
inherited