CurrentNullableIntProperty class
An CurrentProperty with similar characteristics of dart int 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 CurrentPropertyNullValueException.
You can easily check for null by accessing the isNull or isNotNull properties.
When the value of this changes, it will send a CurrentStateChanged event by default. This includes automatically triggering a UI rebuild.
Example
final age = CurrentNullableIntProperty();
if (age.isNull)
{
print("I'm Null");
}
Other Usages Examples
final age = CurrentNullableIntProperty();
print('${age.add(5)}'); //throws CurrentNullValueException because no value has been set yet.
age(10)
print('${age.subtract(5)}'); //prints 5
- Inheritance
-
- Object
- CurrentProperty<
int?> - CurrentNullableIntProperty
Constructors
- CurrentNullableIntProperty({int? value, String? propertyName})
- CurrentNullableIntProperty.zero({String? propertyName})
-
Factory constructor for initializing an CurrentNullableIntProperty to zero.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDirty → bool
-
Returns true if the value of this CurrentProperty is different from the originalValue.
no setterinherited
- isEven → bool
-
Returns true if the int value is even.
no setter
- isNegative → bool
-
Whether this number is negative.
no setter
- isNotNull → bool
-
Returns true if the value of this CurrentProperty is not null.
no setterinherited
- isNull → bool
-
Returns true if the value of this CurrentProperty is null.
no setterinherited
- isOdd → bool
-
Returns true if the int value is odd
no setter
- isPrimitiveType → bool
-
finalinherited
- originalValue → int?
-
no setterinherited
- propertyName ↔ String?
-
getter/setter pairinherited
-
registeredBindings
→ Iterable<
CurrentViewModelBinding> -
Helper bindings registered directly against this property.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sourceHashCode → int
-
finalinherited
- value ↔ int?
-
Returns the current value of this CurrentProperty.
Setting the value will update the value of this CurrentProperty and trigger a UI update if the new value is different from the current value.
If
Tis a reference type, setting the value to a new instance ofTwith the same properties as the current value will still trigger a UI update since the reference has changed.getter/setter pairinherited - viewModel → CurrentStateViewModel
-
Returns the instance of the CurrentStateViewModel this
property is associated with.
no setterinherited
Methods
-
abs(
) → int? - Returns the absolute value of this integer.
-
add<
E extends num> (E other) → E -
Adds
otherto this number. -
addNumber(
num other) → num -
Adds
otherto this number and returns the numeric result. -
call(
int? value, {bool notifyChange = true, bool setAsOriginal = false}) → void -
Updates the underlying
valuefor this CurrentProperty.inherited -
divide<
E extends num> (E other) → double -
Divides this number by
other. -
equals(
dynamic other) → bool -
Checks if
otheris equal to the value of this CurrentProperty.inherited -
hasValueChanged(
int? currentValue, int? originalValue) → bool -
Determines whether the current value differs from the original value.
inherited
-
mod<
E extends num> (E other) → E -
Euclidean modulo of this number by
other. -
modNumber(
num other) → num -
Returns the modulo of this number by
otheras a numeric result. -
multiply<
E extends num> (E other) → E -
Multiplies this number by
other. -
multiplyNumber(
num other) → num -
Multiplies this number by
otherand returns the numeric result. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerBinding(
CurrentViewModelBinding binding) → void -
Registers a helper binding against this property.
inherited
-
reset(
{bool notifyChange = true}) → void -
Resets the value to the originalValue.
inherited
-
set(
int? value, {bool notifyChange = true, bool setAsOriginal = false}) → int? -
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(
CurrentStateViewModel viewModel) → void -
Links this CurrentProperty instance with an CurrentStateViewModel.
inherited
-
subtract<
E extends num> (E other) → E -
Subtracts
otherfrom this number. -
subtractNumber(
num other) → num -
Subtracts
otherfrom this number and returns the numeric result. -
toDouble(
) → double? - The int value as a double
-
toNull(
) → void - Sets the int value to null.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited