highestRole property

Role highestRole

Returns highest role of member. Uses ! on nullable properties and will throw if anything is missing from cache

Implementation

Role get highestRole =>
    this.roles.reduce((value, element) {
      final valueInstance = value.getFromCache();
      final elementInstance = element.getFromCache();

      if (valueInstance!.position > elementInstance!.position) {
        return value;
      }

      return element;
    }).getFromCache()!;