network_image_safe_provider 1.0.0 copy "network_image_safe_provider: ^1.0.0" to clipboard
network_image_safe_provider: ^1.0.0 copied to clipboard

outdated

A NetworkImageProvider with placeholder.

NetworkImageSafeProvider #

A NetworkImageProvider with placeholder.

Installation #

1. Depend on it #

Add this to your package's pubspec.yaml file:

dependencies:
  network_safe_image_provider: ^1.0.0

2. Install it #

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it #

Now in your Dart code, you can use:

import 'package:network_safe_image_provider/network_safe_image_provider.dart';

Usage #

Use NetworkImageSafeProvider instead of Image.network to load images from the network and use a placeholder if floading fails.

Example:

var avatar = new Image(
  image: new NetworkImageSafeProvider('http://example.com/avatars/123.jpg', placeholder: 'assets/placeholder.png'),
);

Remeber to add your placeholder image to your assets in pubspec.yaml

3
likes
0
pub points
4%
popularity

Publisher

verified publishermicropp.net

A NetworkImageProvider with placeholder.

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on network_image_safe_provider