ConsoleActionObserver<St> class
This action-observer will print all actions to the console, with color, like so:
I/flutter (15304): | Action MyAction
This helps with development, so you probably don't want to use it in release mode:
store = Store<AppState>(
...
actionObservers: kReleaseMode ? null : [ConsoleActionObserver()],
);
If you implement the action's toString, you can display more information. For example, suppose a LoginAction which has a username field:
class LoginAction extends ReduxAction {
final String username;
...
String toString() => super.toString() + '(username)';
}
The above code will print something like this:
I/flutter (15304): | Action LoginAction(user32)
- Inheritance
-
- Object
- ActionObserver<
St> - ConsoleActionObserver
Constructors
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
-
observe(
ReduxAction< St> action, int dispatchCount, {required bool ini}) → void -
If
ini==true
this is right before the action is dispatched. Ifini==false
this is right after the action finishes.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- color ↔ String Function(ReduxAction action)
-
Callback that chooses the color to print in the console.
getter/setter pair
Constants
- blue → const String
- bold → const String
- boldItalic → const String
- boldItalicOff → const String
- boldOff → const String
- dark → const String
- green → const String
- grey → const String
- italic → const String
- italicOff → const String
- red → const String
- reset → const String
- reversed → const String
- white → const String
- yellow → const String