CellDeputy class
Deputy is a pattern that allows a Cell that delegates actions to.
An deputy to a human person is someone who provides assistance, support, or services to help that individual with their tasks, duties, or daily life. The responsibilities of an deputy depend on the specific role and the needs of the person they are assisting. to modify behavior without subclassing.
Likewise, a cell can have "deputies" like a body-doubles for cells, they act on behalf of the cell, carrying out tasks with limited authority while ensuring the cell functions smoothly. Just like a general manager signs contracts on behalf of a CEO, these cellular deputies perform tasks without replacing the cell itself but ensuring it operates efficiently.
The CellDeputy
pattern enables:
- Behavior Composition: Adds validation/mapping without subclassing
- Safe Modification: Preserves original cell's immutability
- Aspect Layering: Stacks functionality through multiple deputies
- Dynamic Behavior: Alters behavior at runtime
- Testability: Facilitates unit testing by isolating behavior
- Separation of Concerns: Isolates different aspects of behavior
- Security: Provides controlled access to cell behavior
- Inheritance
- Mixed-in types
- Implementers
Constructors
-
CellDeputy.new({required Cell bind, TestObject<
Cell> ? test, MapObject? mapObject}) - Creates a behavior-augmented view of a cell.
Properties
-
async
→ CellAsync<
Cell> -
Creates an async variant for modifiable operations
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
modifiable
→ Iterable<
Function> -
Returns an iterable containing modifiable functions.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
test
→ TestObject<
Cell> -
Gets the test object associated with the cell.
no setterinherited
- unmodifiable → Cell
-
Creates an unmodifiable view of this cell.
no setterinherited
Methods
-
apply(
Function function, List? positionalArguments, [Map< Symbol, dynamic> ? namedArguments]) → dynamic -
Applies a function with controlled validation.
override
-
deputy(
{covariant TestObject< Cell> ? test, covariant MapObject? mapObject}) → Cell -
Creates a new deputy layered on top of this one.
override
-
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