AccessMode constructor

AccessMode(
  1. dynamic acs
)

Create new instance by passing an AccessMode or Map<String, dynamic>

Implementation

AccessMode(dynamic acs) {
  if (acs != null) {
    _given = acs['given'] is int ? acs['given'] : AccessMode.decode(acs['given']);
    _want = acs['want'] is int ? acs['want'] : AccessMode.decode(acs['want']);

    if (acs['mode'] != null) {
      if (acs['mode'] is int) {
        mode = acs['mode'];
      } else {
        mode = AccessMode.decode(acs['mode']) ?? 0;
      }
    } else {
      mode = _given & _want;
    }
  }
}