getIntent static method

int getIntent(
  1. List<Intent> intents
)

Implementation

static int getIntent (List<Intent> intents) {
  List<int> values = [];

  List<Intent> source = intents.contains(Intent.all) ? Intent.values : intents;
  for (Intent intent in source) {
    values.add(intent.value);
  }

  if (values.isEmpty) {
    throw ShardException('Missing intents : no intent was given, please define which ones are useful to you.');
  }

  return values.reduce((value, element) => value += element);
}