checkFlag static method

bool checkFlag(
  1. AccessMode val,
  2. String? side,
  3. int flag
)

Returns true if AccessNode has x flag

side: mode / want / given

Implementation

static bool checkFlag(AccessMode val, String? side, int flag) {
  side ??= 'mode';
  var found = ['given', 'want', 'mode'].where((s) {
    return s == side;
  }).toList();

  if (found.isNotEmpty) {
    return ((val[side] & flag) != 0);
  }
  throw Exception('Invalid AccessMode component "' + side + '"');
}