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> { ...@@ -97,10 +97,10 @@ class PrintQueueBloc extends Bloc<PrintQueueEvent, PrintQueueState> {
_log.finer(formatResponse(response)); _log.finer(formatResponse(response));
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (response.body != null) { if (response.body != null) {
return List.from( return (json.decode(response.body) as List)
(json.decode(utf8.decode(response.bodyBytes)) as Iterable).map<PrintQueueTask>( ?.map<PrintQueueTask>(
(dynamic value) => PrintQueueTask.fromMap(value as Map<String, dynamic>)), (dynamic value) => PrintQueueTask.fromMap(value as Map<String, dynamic>))
); ?.toList() ?? [];
} else { } else {
return []; 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