Entity<Key extends EntityKey> class

Represents an entity with a unique identifier and timestamp.

This is a base class for all entities in the system. Each entity has:

  • A unique identifier (id)
  • A timestamp (timeMills)
  • An associated key of type Key

Type parameter Key must extend EntityKey.

Inheritance
Implementers

Constructors

Entity({String? id, int? timeMills, Key? key})
Creates an entity with optional id, timeMills, and key
const
Entity.auto({String? id, int? timeMills, Key? key})
Creates an entity with auto-generated id and timeMills if not provided

Properties

dateTime → DateTime
The timestamp as a DateTime object
no setter
dateTimeOrNull → DateTime?
The timestamp as a DateTime object, or null if invalid
no setter
filtered → Map<String, dynamic>
Returns the entity as a map with only insertable fields
no setter
filteredJson → String
Returns the filtered entity as a JSON string
no setter
hashCode → int
The hash code for this object.
no setteroverride
id → String
The unique identifier of the entity as a string
no setter
idInt → int
The unique identifier of the entity as an integer
no setter
idOrNull → String?
final
ignoredKeys → Iterable<String>
Returns keys that are ignored (not insertable)
no setter
json → String
Returns the entity as a JSON string
no setter
key → Key
The key associated with the entity
no setter
props → Iterable<Object?>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → Map<String, dynamic>
Returns the entity as a map with all fields
no setter
timeMills → int
The timestamp in milliseconds since epoch
no setter
timeMillsOrNull → int?
final

Methods

equals(Object? e1, Object? e2) → bool
Compare two elements for being equal.
inherited
hash(Object? o) → int
Creates a combined hash code for a number of objects.
inherited
isInsertable(String key, dynamic value) → bool
Checks if a field is insertable (valid key and non-null value)
isValidKey(Object? o) → bool
Test whether an object is a valid argument to equals and hash.
inherited
iterableEquals<T>(Iterable<T> a, Iterable<T> b, {bool unordered = false, bool equals(T a, T b)?}) → bool
makeKey() → Key
Constructs the key for the entity.
modify<T extends Object>(Modifier<T>? current, T? old) → T?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notEquals(dynamic e1, dynamic e2) → bool
Compare two elements for being not equal.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override