Skip to content

A package that allows you to handle adaptive images with ease.

License

Notifications You must be signed in to change notification settings

n-bernat/multi_network_image

Repository files navigation

Multi Network Image

Package Publisher MIT License LeanCode Style

multi_network_image is a package that allows you to handle adaptive images with ease.

Status Comments
multi_network_image - Tests (stable) Current stable Flutter version
multi_network_image - Tests (beta) Current beta Flutter version
multi_network_image - Tests (3.27.0) The oldest supported Flutter version

Getting started

  1. Add this package to your dependencies.
dependencies:
  multi_network_image: latest_version
  1. Get the dependencies.
flutter pub get
  1. Use MultiNetworkImage as a source for your Image.
return Image(
  image: MultiNetworkImage([
    // The main image that we want to display.
    'https://picsum.photos/2000',
    // You can provide additional images that will be used
    // as a fallback if the main image is not available.
    'https://picsum.photos/200',
    // The low-quality image that, if cached, will be used
    // as a placeholder.
    'https://picsum.photos/20',
  ]),
);

Details

MultiNetworkImage will look for the first image that is both provided in the list and is cached, and will use it as an initial source.

After that (or if no image is cached), it will try to fetch the first image from the list. If it fails, it will try the next one, and so on.

It allows you to provide a low-quality image as a fallback, and a high-quality image as a primary source.

Additional information

  • This package requires at least Flutter 3.27.0 to work.
  • If there are any issues feel free to go to GitHub Issues and report a bug.

Maintainers

About

A package that allows you to handle adaptive images with ease.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published