EventArgs class
Represents data (arguments) that is provided to subscribers when an Event occurs. It includes two values:- whenOccurred - the date/time the Event is broadcast, and eventName - an optional name that can be used to identify the associated event.
Extend this class with your own custom derived class, to provide subscribers with some specific data relating to an Event.
// example custom arguments
class MyValue extends EventArgs {
int myValue;
MyValue(this.myValue);
}
...
var e = Event<MyValue>();
e.subscribe((args) => print(args.myValue);
e.broadcast(MyValue(99));
// prints 99
}
Note: An EventArgs instance is broadcast
even when not explicitly
specified as an argument to the broadcast
method. This means that
eventName and whenOccurred are always available.
// example ...
var e = Event(); // (#1)
e.subscribe((args) => print(args.whenOccurred);
e.broadcast(); // (#2)
// prints the date/time the Event e is broadcast.
// (#1) equivalent to Event<EventArgs>()
// (#2) same as e.broadcast(EventArgs());
As a shortcut to creating your own custom EventArgs derived class, you can use one of the two provided derived classes:- Value and Values. These classes let you provide one or two typed values to your subscribers. See the descriptions of these two classes.
- Implementers
- CoinbaseConnectEvent
- CoinbaseErrorEvent
- CoinbaseResponseEvent
- CoinbaseSessionEvent
- CompleteSocialLoginEvent
- MagicConnectEvent
- MagicErrorEvent
- MagicLoginEvent
- MagicRequestEvent
- MagicSessionEvent
- ModalConnect
- ModalDisconnect
- ModalError
- ModalNetworkChange
- PhantomConnectEvent
- PhantomErrorEvent
- PhantomResponseEvent
- PhantomSessionEvent
Constructors
Properties
- eventName ↔ String?
-
The name of associated Event. Default value is null. Typically set by external code.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- whenOccurred ↔ DateTime?
-
The date/time when the event is
broadcast
. Until broadcast, the value is null.getter/setter pair
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