MakeObservable class

Internal class only used for code-generation with mobx_codegen.

During code-generation, this type is detected to identify an Observable readOnly indicates that the field is only modifiable within the Store. It is possible to override equality comparison of new values with equals.


bool _alwaysNotEqual(_, __) => false;

@MakeObservable(equals: _alwaysNotEqual)
String alwaysNotifyObservable = 'hello';

bool _equals(oldValue, newValue) => oldValue == newValue;

@MakeObservable(equals: _equals)
String withEquals = 'world';

Constructors

MakeObservable({bool readOnly = false, Function? equals, bool useDeepEquality = true})
const

Properties

equals Function?
A Function to use check whether the value of an observable has changed.
final
hashCode int
The hash code for this object.
no setterinherited
readOnly bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
useDeepEquality bool
By default, MobX uses the == to compare the previous value. This is fine for primitives, but for Iterable and Map, you may want to use a deep equality on collections. When using deep equal, no reaction will occur if all elements are equal.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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