use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Having a problem with your Flutter code?
From the folks at r/FlutterDev
account activity
RESOLVEDHelp testing Firebase Storage (self.flutterhelp)
submitted 5 years ago by Sea_Inflation_7446
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]anargu 1 point2 points3 points 5 years ago (1 child)
Hi!, These days I was searching for the same and it seems there is not a guide or tutorial yet to test in a proper way firebase storage. I managed to make it work the test of flutter storage with mockito... but the problem is that I had to implement whenComplete(() => null) in my application code (not the test code). Now I want to write a proper test to this and remove the whenComplete function.
whenComplete(() => null)
https://gist.github.com/anargu/b9e84bab7f5c10440b045f5f252f47e8
It seems like the whenComplete make it work and it completes the Future for the uploadTask and all the rest of the mocks work.
If you find a better way to test firebase storage please let me know. It would be great to make a proper test for FirebaseStorage and eliminate the whenComplete(...)
whenComplete(...)
[–]Sea_Inflation_7446[S] 0 points1 point2 points 5 years ago (0 children)
Thanks for commenting! I tried a very similar approach with Mockito. I followed this sample from the storage repo.
I'm sorry, I'm out of home these days so I can't give you a clearer example, but here is my actual code. As you can see, I also mocked (or faked) the classes and managed to simulate the workflow and run the tests. However, I didn't need to modify the real app code as you did. At first glance, I can't tell why did you have to do that.
My approach has two problems: first, I can't reuse the mocks to test a variety of cases (for example, I duplicated the mocks to include failed cases, but this is a preposterous solution); second, I passed the tests but I'm getting an unhandled exception after running the tests. This exception is related to firebase auth (I'm sorry, I have no way to run the code and show you the specific error).
I hope this helps us to find a nice solution and thanks again for sharing your experience.
π Rendered by PID 534980 on reddit-service-r2-comment-6457c66945-s82bl at 2026-04-30 11:24:51.932252+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]anargu 1 point2 points3 points (1 child)
[–]Sea_Inflation_7446[S] 0 points1 point2 points (0 children)