Component class Null safety

An independent element in the application

A component is defined by the following characteristics:

  1. A component does not have any dependencies to other components
  2. A component is fully testable as a unit
  3. Communication is only possible through the broadcasting and receiving of events
  4. is synchronous, meaning that an event needs to exit a component before entering the next

Dependencies from another layer can be resolved through injection. Every component lives inside a registry, therefor has access to the container that provides the implementation.

Implementers

Constructors

Component()

Properties

componentRegistry ComponentRegistry
late, final
hashCode int
The hash code for this object.
read-only, inherited
priority int
late, final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

initListeners() FutureOr<void>
called when registering/unregistering events;
inject<T>(DependencyInjector<T> injector) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
onError(Object error, StackTrace trace, Event event) FutureOr<void>
onLoad() → void
called when the component is loaded
onUnload() → void
called when the component is unloaded;
registerEvent<T extends Event>(EventListener<T> onEvent, [int? priority]) → void
used to register a callback to an event
send<T extends Event>(T event) FutureOr<void>
sends an event onto the eventbus
toString() String
A string representation of this object.
inherited

Operators

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