hasFlag method

Determines whether one or more bit fields are set in the current enum value.

final fileAttributes = FileAttributes.readOnly | FileAttributes.archive;
fileAttributes.hasFlag(FileAttributes.readOnly)); // `true`
fileAttributes.hasFlag(FileAttributes.temporary)); // `false`
fileAttributes.hasFlag(
    FileAttributes.readOnly | FileAttributes.archive)); // `true`

Implementation

bool hasFlag(DevicePickerDisplayStatusOptions flag) {
  if (value != 0 && flag.value == 0) return false;
  return value & flag.value == flag.value;
}