fluttercommunity / flutter_blurhash

Compact representation of a placeholder for an image. Encode a blurry image under 30 caracters for instant display like used by Medium. Maintainer: @Solido
https://pub.dev/packages/flutter_blurhash
MIT License
523 stars 66 forks source link

[Feature] add header for download image #41

Closed beerline closed 2 years ago

beerline commented 2 years ago

Hi, and thank u for such a good library!

In my case image on server protected by auth token which should be passed in the Header. Since blurhash used Image.network under the hood now it is impossible to pass token.

Seems like to reach this goal at the BlurHashState.prepareDisplayedImage instead of Image.network we need use:

Image(
    image: NetworkImage(
    imagePath,
    headers: {
      HttpHeaders.authorizationHeader: 'token',
    },
),

Let me know what u thinking and i can help with implementation

Robert-Scub commented 2 years ago

Oh this is an interesting case! We should be able to pass an optional Headers paramaters. Would it be enough for you?

Solido commented 2 years ago

Pushed on 0.6.6 @beerline