atn832 / firebase_storage_mocks

BSD 2-Clause "Simplified" License
11 stars 25 forks source link

getData method does not work with putFile #39

Open jbadger3 opened 1 month ago

jbadger3 commented 1 month ago

It looks like the current getData method mock_storage_reference.dart only looks at the storedDataMap.

  Future<Uint8List?> getData([int maxSize = 10485760]) {
    return Future.value(_storage.storedDataMap[_path]);
  }

Shouldn't this method look similar to the delete method and also check storedFilesMap?

I've run into some issues when trying to use putFile instead of putData.

atn832 commented 1 month ago

You're right. We could either make getData look at storedFilesMap and storedStringMap like the rest of the code, or consolidate all 3 maps into one Map<String, Uint8List> storedData. If we consolidate all 3 maps into one, putFile, putData and putString would store into that and it simplifies the rest of the code. The latter seems cleaner, but would require a bit more work.

I'm not sure when I could tackle this. If you can propose a PR though, I'll be happy to review it and publish it!