Event<T> class

dùng để wrap các event muốn sử dụng trong state, các event này sẽ bắt buộc phải khởi tạo qua hàm Event.from(data), trong hàm này sẽ tự động tạo ra 1 trường thời gian = thời gian lúc gọi hàm.

nên sẽ đảm bảo được event cũ sẽ luôn khác event mới. khi dùng chỉ cần select tới đúng biến event là được.

nếu chỉ dùng Enum làm event bình thường thì sẽ có 1 hạn chế đó là. nếu muốn gán event 2 lần liên tiếp giống nhau thì khi select nó sẽ chỉ hiểu 1 event đầu, và event thứ 2 sẽ không được gọi.

Hoặc có trường hợp như sau: ban đầu mình đã gán event rồi. nhưng sau đó mình gán các trường khác event thì nếu không select trường event thì sẽ bị bị xử lý nhầm event cũ.

Annotations
  • @freezed

Constructors

Event.from(T data)
Cách duy nhất để tạo 1 event mới, nó sẽ tự động gán event data với thời gian lúc gọi hàm, đảm bảo event này luôn khác event cũ kể cả trường hợp data là giống nhau
factory

Properties

copyWith → $EventCopyWith<T, Event<T>>
no setterinherited
data → T
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
time int
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