decode static method
Decodes the bitfield into days, i.e. (1 to 7) of a week. encoded
should be between 0 and 128.
Behaviour is undefined if encoded
is invalid.
Implementation
static Iterable<int> decode(int encoded) sync* {
assert(encoded >= 0 && encoded < 128, 'Packed days is "$encoded", should be between 0 and 127');
for (var day = 1; day <= 7; day++) {
if (encoded.isOdd) {
yield day;
}
encoded >>= 1;
}
}