Operational Data Models
Queue Snapshot
Filter Ticket Records
A small list of record-like maps can model a queue snapshot without any host service. The selector changes which ticket status the report highlights.
Program
Play the program to choose the ticket status and inspect the queue snapshot.
queue_snapshot_model.dart
void main() {
var wantedStatus = ;
var tickets = [
{'status': 'open', 'severity': 'high'},
{'status': 'waiting', 'severity': 'normal'},
{'status': 'open', 'severity': 'normal'},
];
var visible = tickets.where((ticket) => ticket['status'] == wantedStatus).length;
var high = tickets.where((ticket) => ticket['severity'] == 'high').length;
var line = '$wantedStatus tickets=$visible high=$high';
print(line);
}
void main() {
var wantedStatus = ;
var tickets = [
{'status': 'open', 'severity': 'high'},
{'status': 'waiting', 'severity': 'normal'},
{'status': 'open', 'severity': 'normal'},
];
var visible = tickets.where((ticket) => ticket['status'] == wantedStatus).length;
var high = tickets.where((ticket) => ticket['severity'] == 'high').length;
var line = '$wantedStatus tickets=$visible high=$high';
print(line);
}
record-like maps
The ticket maps carry only the fields needed by the snapshot.
where
`where` keeps rows whose status matches the selected value.
summary line
The output reports the selected bucket and one independent severity count.