I have a problem in my flutter app , and the problem is in the storage of firebase .
I have a collection with field called avatar(String)
. It's value comes from an image link , so first i uploaded the images to firebase storage and i changed the rules to allow read .
so when i refresh the code i get this error.
═══════ Exception caught by image resource service ════════════════════════════════════════════════
The following ArgumentError was thrown resolving an image
codec:
Invalid argument(s): Unsupported scheme 'gs' in URI gs://pfe-2020-51d9c.appspot.com/Asperge/asperges%20(1).jpg
When the exception was thrown, this was the stack:
#0 _HttpClient._openUrl (dart:_http/http_impl.dart:2278:9)
#1 _HttpClient.getUrl (dart:_http/http_impl.dart:2197:48)
#2 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:84:59)
#3 NetworkImage.load (package:flutter/src/painting/_network_image_io.dart:47:14)
#4 ImageProvider.resolve.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:327:17)
... Image provider: NetworkImage("gs://pfe-2020-51d9c.appspot.com/Asperge/asperges (1).jpg", scale: 1.0) Image key: NetworkImage("gs://pfe-2020-51d9c.appspot.com/Asperge/asperges (1).jpg", scale: 1.0) ════════════════════════════════════════════════════════════════════════════════════════════════════
And this is my dart code
===================================================================================================
ClipRRect(
child: Image.network(snapshot.data[index].data['avatar'],
height: 100,
width: 170,
fit: BoxFit.fill,
),
borderRadius: BorderRadius.circular(20),
),