websafe_network_image 1.0.7 websafe_network_image: ^1.0.7 copied to clipboard
Simple abstraction to be able to detect Web, Android, and iOS without a hard reference to `dart:io`
websafe_network_image #
A Flutter compatible library to handle cached network images for Android, iOS while falling back to the built in image for Web. As far as possible, this is designed to be a drop-in replacement for the CachedNetworkImage package.
For web where there is headers involved, this will bypass Flutter's (and the
browser's) built in cache and attempty to load the images directly using the
http
package. This is because the current NetworkImage
does not support
headers because it uses the built in browser implementation.
Using the library #
Add the repo to your Flutter pubspec.yaml
file.
dependencies:
websafe_network_image: <<version>>
Then run...
flutter packages get
Example #
import 'package:websafe_network_image/websafe_network_image.dart';
...
Widget build(BuildContext context) {
return WebsafeNetworkImage(
imageUrl: imageUrl,
...
);
}