Comments (3)
(getBucket
is not going to yield the location.) I've taken a closer look at the Firebase Storage API and am truly surprised that one can translate a Url
to a StorageReference
, but not the other way around -- at least easily.
At the application level, using fully qualified Urls for Firebase Storage is problematic if you want to be able to export/import between databases. Hence, I store relative paths and use StorageReference.child
to compute the correct image location... Alas, getting that into a location
string requires TWO ASYNC calls. 🤦♂️
from firebase_image.
I managed to get this working fairly well. I reluctantly wrapped a FutureBuilder around the FadeInImage, but since it shows the BlurHash placeholder (same as FadeInImage), it does not create the jank that I was initially worried about.
I still think Firebase Storage needs to improve their API. I opened an issue for them, but I'm not holding my breathe. If they improve their API, I can improve my code.
I still think there is room to revise FirebaseImage to be more StorageReference centric rather than String centric.
from firebase_image.
You can give storage reference of folder too.
This is how..
Future downloadFile(String duaName) async {
final Directory tempDir = Directory.systemTemp;
final File file = File('${tempDir.path}/$duaName');
final StorageReference ref = FirebaseStorage.instance.ref().child('FileType.image/').child('$duaName');
String url = await ref.getDownloadURL();
final http.Response downloadData = await http.get(url);
var bodyBytes = downloadData.bodyBytes;
_scaffoldKey.currentState.showSnackBar(
SnackBar(
backgroundColor: Colors.white,
content: Image.memory(
bodyBytes,
fit: BoxFit.fill,
),
),
);
final StorageFileDownloadTask downloadTask = ref.writeToFile(file);
print(downloadTask.toString());
return url;
}
Hope this is helpful for you.
from firebase_image.
Related Issues (20)
- Resolve Incompatibility with firebase_storage ^5.0.0 HOT 2
- shouldCache seems to be broken HOT 11
- Update firebase_storage dependency to ^7.0.0 HOT 7
- In my flutter application user has to submit or upload 3 images and 2 PDFs randomly. HOT 1
- Feature request: easy way to pre-cache by url HOT 6
- Update Firebase dependency HOT 3
- Warning: Operand of null-aware operation '!' has type 'String' which excludes null. HOT 7
- path with spaces returns object-not-found HOT 1
- TypeError (type 'Null' is not a subtype of type 'Reference') HOT 15
- Null Safety isn't done very well. HOT 1
- Invalid argument: Instance of 'Reference' HOT 1
- Any reason this won't work with Flutter Web? HOT 2
- Optional placeholder widget while loading HOT 2
- Web Support HOT 1
- /C:/Users/kuk/Documents/sdk/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_image-1.0.1/lib/src/cache_manager.dart:29:13: Warning: Operand of null-aware operation '!' has type 'String' which excludes null. join((await getDatabasesPath())!, dbName), ^
- update dependencies HOT 4
- umlauts seem break the plugin
- Exception: download-size-exceeded
- Icon progress indicator
- Package needs dependency updates HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase_image.