Cacheable<T extends Snowflake, S extends SnowflakeEntity> class abstract

Wraps SnowflakeEntity that can be taken from cache or optionally downloaded from API. Always provides id of entity. download() method tries to get entity from API and returns it upon success or throws Error if something happens in the process.

Implementers

Constructors

Cacheable(INyxx client, T id)

Properties

client INyxx
final
hashCode int
The hash code for this object.
read-onlyoverride
id → T
Id of entity
final
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

download() Future<S>
Downloads entity from cache and caches result
getFromCache() → S?
Returns entity from cache or null if not present
getOrDownload() FutureOr<S>
Returns entity from cache or tries to download from API if not found. If downloading is successful it caches results
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.
override