Identity class

An Identity exists solely to return the specified argument Status from its update() method. An Identity compares equal to another Identity if they are both constructed with the same Status.

Example:

void identityExample() {
  final success = const Identity(Status.success);
  // always returns the specified Status
  assert(success.update() == Status.success);
  assert(success.update() == Status.success);

  final otherSuccess = Identity(Status.success);
  // two instances with the same Status compare as equal
  assert(success == otherSuccess);
  assert(success.update() == otherSuccess.update());
}
Inheritance

Constructors

Identity(Status _status)
Constructs an Identity instance that always returns the specified Status argument when its update() method is called.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Operators

operator ==(Object rhs) bool
The equality operator.
override

Constants

failure → const Identity
An Identity instance that returns the Status.failure Status.
running → const Identity
An Identity instance that returns the Status.running Status.
success → const Identity
An Identity instance that returns the Status.success Status.