Action

Base class for all actions. Extend this to create type-safe actions with pattern matching.

Example:

// Define your actions as a sealed hierarchy in YOUR code
sealed class CounterAction extends Action {}

final class Increment extends CounterAction {} final class Decrement extends CounterAction {} final class SetValue extends CounterAction { const SetValue(this.value); final int value; } final class Reset extends CounterAction {}

// Reducer uses exhaustive pattern matching - no strings! int counterReducer(int state, Action action) => switch (action) { Increment() => state + 1, Decrement() => state - 1, SetValue(:final value) => value, Reset() => 0, _ => state, // Handle system actions };

Implementers

Constructors

Action()
Creates an action.
const

Properties

hashCode int
The hash code for this object.
no setterinherited

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

toString() String

A string representation of this object.
inherited

Operators

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