ClassSwitch class

Annotate a class with @ClassSwitch to get class switching helper code generated for you.

The annotated class will have a .$switch extension function created on it. The annotated classes name will be used to generate two mixin classes called _${AnnotatedClassName}Switcher and _${AnnotatedClassName}SwitcherWithDefault

Constructors

ClassSwitch({List<Type> classes = const [], ClassSwitchOptions options = const ClassSwitchOptions()})
const

Properties

classes List<Type>
Explicitly provide a list of base classes to generate a switcher for. When multiple are provided then the switch functions will take an instance of each base class in turn and then require case functions for every possible combination of sub-types.
final
hashCode int
The hash code for this object.
no setterinherited
options ClassSwitchOptions
Experimental options for configuring how class switch generates code.
final
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