asIndices function
Implementation
Uint8List asIndices(int bitmap) {
if (bitmap < 0 || bitmap > 1024) {
throw ArgumentError('Invalid bitmap');
}
final res = <int>[];
for (int i = 0; i < 10; i++) {
if ((bitmap & (1 << i)) != 0) {
res.add(i);
}
}
return Uint8List.fromList(res);
}