Commit 179c34d4 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

make print queue more null resistant

parent 42d12e37
......@@ -97,10 +97,10 @@ class PrintQueueBloc extends Bloc<PrintQueueEvent, PrintQueueState> {
_log.finer(formatResponse(response));
if (response.statusCode == 200) {
if (response.body != null) {
return List.from(
(json.decode(utf8.decode(response.bodyBytes)) as Iterable).map<PrintQueueTask>(
(dynamic value) => PrintQueueTask.fromMap(value as Map<String, dynamic>)),
);
return (json.decode(response.body) as List)
?.map<PrintQueueTask>(
(dynamic value) => PrintQueueTask.fromMap(value as Map<String, dynamic>))
?.toList() ?? [];
} else {
return [];
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment