DEV Community


Answer: Flutter how to handle error (like 404 or wrong url)

Pratik Butani
Android Developer By Passion | Freelancer | Being Helpful By Nature | Stack-Overflowing | Fluttering | Exploring Kotlin & Flutter.
・1 min read

You can display image from assets when you found 404 or any other error while loading image.

What I have done is:

      image: NetworkImage("imageUrl"),
      placeholder: AssetImage(
          (context, error, stackTrace) {
        return Image.asset(
            fit: BoxFit.fitWidth);
      fit: BoxFit.fitWidth,

Check imageErrorBuilder property.

Discussion (0)