abstractMethodPrefix property Null safety
final
For the generated Switcher classes this is an optional prefix that will be applied to the names of all of the generated abstract sub type methods.
For example abstractMethodPrefix:'on'
results in abstract methods
named like onEventA
. A full example is shown below:
@ClassSwitch(options:ClassSwitchOptions(abstractMethodPrefix:"on"))
abstract class Event {}
class EventA extends Event {}
class EventB extends Event {}
// The above will generate a Switcher which when mixed in has abstract
// methods named using the provided abstractMethodPrefix:
class MyEventHandler with _$EventSwitcher<int> {
@override
int onEventA(EventA eventA) => 1;
@override
int onEventB(EventB eventB) => 2;
}
This is useful for when you want to create a more readable API for one of your switcher classes.
Implementation
final String abstractMethodPrefix;