Sagar Kothari avatar

Flutter/Dart - Fade in Network Image with error handlers

sagarkothari88

Published: 04 Mar 2022 › Updated: 04 Mar 2022Flutter/Dart - Fade in Network Image with error handlers

Flutter/Dart - Fade in Network Image with error handlers

I use following code snippet to load image from network

FadeInImage.assetNetwork(
    // 1. Provide placeholder
    placeholder: 'assets/branding/three_speak_logo.png',

    // 2. Provide network url in string
    image: data.result.metadata.profile.profileImage, 

    fit: BoxFit.cover,

    // 3. Placeholder image error handler
    placeholderErrorBuilder: (context,  error, stackTrace) {
        return Image.asset('assets/branding/three_speak_logo.png');
    },

    // 4. Network image error handler
    imageErrorBuilder: (context, error, stackTrace) {
        return Image.asset('assets/branding/three_speak_logo.png');
    },
)

Leave Flutter/Dart - Fade in Network Image with error handlers to:

Written by

App Developer on Hive - Distriator, Check in With XYZ, 3Speak, HiveSuite.app.

Read more #hive-186042 posts


Best Posts From Sagar Kothari

More Posts From Sagar Kothari