flutter_comms library

Classes

ListenerBloc<Event, State, Message>
Handles Listener's listen and close.
ListenerCubit<State, Message>
Handles Listener's listen and close.
ListenerDelegate<T>
Helper class used in MultiListener to create Listeners of specified types.
MessageListener<Message>
Takes a OnMessage function wchich will be called each time any Sender of type argument Message sends a message.
MessageSinkRegister
Allows communication between Listeners and Senders of the same type, without the need of them knowing about each other.
MultiMessageListener
Merges multiple MessageListener widgets, improving the readability of nested MessageListeners.
SenderFunctor<Message>

Mixins

Listener<Message>
A mixin used on classes that want to receive messages of type Message.
MessageListenerSingleChildWidget
Mixin which allows MultiMessageListener to infer the types of multiple MessageListeners.
MultiListener
A mixin used on classes that want to receive messages of multiple types.
Sender<Message>
A mixin used on classes that want to send messages of type Message, by providing send function.
StateSender<State>
Sends emitted States to all Listeners of type State.

Functions

getSend<Message>() SenderFunctor<Message>
Returns an object that can be called like a function (a functor) which sends messages to all Listeners of type Message, without the need of instatiating a class with Sender mixin.
useMessageListener<Message>(OnMessage<Message> onMessage, {OnMessage<Message>? onInitialMessage, List<Object?> keys = const <Object>[]}) → void
Calls onMessage everytime a message of type Message is received.

Typedefs

LoggerCallback = void Function(String message)
OnMessage<Message> = void Function(Message message)
Signature for callbacks that are run when a message is received.