parse static method
Parses the bitfield into booleans, i.e. true
if a digit is 1. encoded
should be between 0 and 128.
The returned Iterable is little-endian with true
indicating the presence of a day.
That is so say, the first element in the returned iterable will represent whether Monday is present.
For example, [true, false, false true, false, false, false]
will indicate that Monday and Thursday
is present.
Behaviour is undefined if encoded
is invalid.
Implementation
static Iterable<bool> parse(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++) {
yield encoded.isOdd;
encoded >>= 1;
}
}