fetch method

  1. @override
Future<Entitlement> fetch(
  1. Snowflake id
)
override

Fetch the item with the given id from the API.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<Entitlement> fetch(Snowflake id) async {
  final entitlements = await list(before: Snowflake(id.value + 1));

  return entitlements.firstWhere(
    (entitlement) => entitlement.id == id,
    orElse: () => throw EntitlementNotFoundException(applicationId, id),
  );
}