ConsoleActionObserver<St> class Null safety

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

Constructors

ConsoleActionObserver()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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. If ini==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.
read / write

Constants

blue → const String
"\x1B[38;5;45m"
bold → const String
"\u001b[1m"
boldItalic → const String
bold + italic
boldItalicOff → const String
boldOff + italicOff
boldOff → const String
"\u001b[22m"
dark → const String
"\x1B[38;5;238m"
green → const String
"\x1B[38;5;118m"
grey → const String
"\x1B[38;5;246m"
italic → const String
"\u001b[3m"
italicOff → const String
"\u001b[23m"
red → const String
"\x1B[38;5;9m"
reset → const String
"\u001b[0m"
reversed → const String
"\u001b[7m"
white → const String
"\x1B[38;5;255m"
yellow → const String
"\x1B[38;5;226m"