flutter_cache_manager icon indicating copy to clipboard operation
flutter_cache_manager copied to clipboard

I can't pass a File in FileInfo (overriding getFileStream() for testing)

Open saksham-gt opened this issue 3 years ago • 1 comments

💬 Questions and Help

I want to do widget testing on a CircleAvatar, but to mock the image I need to pass an asset file. But, as I pass File('path/to/mock/img'), it shows me the error:

Abstract classes can't be instantiated. Try creating an instance of a concrete subtype.

And, file 6.1.2 classifies file as abstract. Then, how can I pass file in getFileStream()?

Is there any work around for this? If so, do suggest.

@renefloor

For questions or help we recommend checking:

saksham-gt avatar Mar 06 '22 08:03 saksham-gt

You should be able to create a new class: class MockFile extends File You could also use something like mockito for that.

renefloor avatar Mar 06 '22 08:03 renefloor