networkImage static method

Widget networkImage({
  1. required String image,
  2. required ImageProvider<Object> placeholder,
  3. Widget? placeholderWidget,
  4. double? size,
  5. BoxFit fit = BoxFit.fill,
})

Implementation

static Widget networkImage({
  required String image,
  required ImageProvider placeholder,
  Widget? placeholderWidget,
  double? size,
  BoxFit fit = BoxFit.fill,
}) {
  return FadeInImage(
    key: ValueKey(image),
    width: size,
    height: size,
    placeholder: placeholder,
    placeholderFit: fit,
    placeholderErrorBuilder: (context, error, stackTrace) {
      return placeholderWidget ?? Container();
    },
    image: NetworkImage(image),
    fit: fit,
    imageErrorBuilder: (context, error, stackTrace) {
      return placeholderWidget ?? Container();
    },
  );
}