/// Serializes operations without letting a failed operation poison later work. class SerialQueue { Future _tail = Future.value(); Future run(Future Function() operation) { final result = _tail.then((_) => operation()); _tail = result.then((_) {}, onError: (Object _, StackTrace _) {}); return result; } }