4

The Dart FakeAsync package seems to have the same functionality as quiver.testing.async inside the Quiver package so as a Flutter and Dart app developer I'm confused as to which one to use?

Is one supposed to be used over the other in particular circumstances? nothing in the documentation for either package gives any guidance on this either. Both packages also seem to be authored and maintained by members of the Google Flutter and Dart teams which makes it even more confusing.

The only thing I can see is that FakeAsync package is last updated in July 2018 while Quiver was in Nov 2019, so is FakeAsync deprecated? if so it's not labelled as such. And also a small number of core packages currently depend on FakeAsync, while a very large number of diverse package depend on quiver (though can't know if they depend on quivers testing.async).

4
  • 1
    package:fake_async's changelog does mention it a bit: package:fake_async at a time was a superset of quiver's FakeAsync. However, currently quiver's version has diverged, so package:fake_async is no longer fully backwards compatible (for example, I added FakeAsync.pendingTimersDebugInfo to quiver's version). =/
    – jamesdlin
    Commented Feb 10, 2020 at 11:00
  • 1
    Also, FWIW, Flutter uses quiver's, so for better or for worse, I expect that the quiver version has more inertia behind it.
    – jamesdlin
    Commented Feb 10, 2020 at 11:03
  • Brilliant thanks @jamesdlin ! I'd happily mark your comment as accepted if you make it a answer.
    – Maks
    Commented Feb 10, 2020 at 20:28
  • 1
    FYI, Flutter now uses package:fake_async, so reverse everything I said before.
    – jamesdlin
    Commented Aug 21, 2020 at 8:04

1 Answer 1

3

I tried (with limited success) to dig into the muddled history.

FakeAsync was a third-party contribution to quiver, and a few months later, the author forked package:fake_async from quiver's version. I don't know what the rationale was for having two separate implementations, but I could guess that perhaps the author wanted to have more direct control over the code. (In other words, package:fake_async initially was not authored nor owned by Google.)

I asked around, and my understanding is that package:fake_async stopped being maintained, and Google's Dart team ended up taking ownership of package:fake_async so that it could be updated for Dart 2.

From package:fake_async's changelog, it does appear that it was meant to be a superset of quiver's version, but the implementations have since diverged so that it's no longer fully backward compatible.

At this point, I personally would use the quiver version: it's better maintained and is what Flutter uses, so I expect that it has much more inertia behind it.

I've also filed https://github.com/dart-lang/fake_async/issues/16 requesting that guidance be added to the documentation.

Update

Flutter moved in the other direction and switched to using package:fake_async instead, so I now recommend using package:fake_async too. package:fake_async has been updated to be a proper superset of of the quiver version. Also see https://github.com/google/quiver-dart/issues/590.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.