1
@override
  Widget build(BuildContext context) {
    return Image.network(
      '...',
      fit: BoxFit.fitHeight,
    );
  }

how to use local image from image.network if device is offline or image not found ?

Herdanis
  • 11
  • 1
  • looking for placeholder and onError section: checkout this [https://stackoverflow.com/questions/52568872/flutter-how-to-handle-image-network-error-like-404-or-wrong-url/56513785](https://stackoverflow.com/questions/52568872/flutter-how-to-handle-image-network-error-like-404-or-wrong-url/56513785) – Ninja Oct 27 '20 at 08:47

1 Answers1

0

Use FadeInImage widget it take placeholder that if image not loaded it will show placeholder instead but if image loaded it show image.

FadeInImage(
  placeholder: AssetImage("url"),
  image: NetworkImage('https://backend.example.com/image.png'),
)
Mohammad_Asef
  • 292
  • 2
  • 17