0

I'm retrieving images from API:

  base64FormatImage = base64FormatImage.toString();
  base64FormatImage = base64FormatImage.replaceAll('data:image/jpeg;base64,', '');
  base64FormatImage = base64FormatImage.replaceAll('}', '');
  base64FormatImage = base64FormatImage.replaceAll('data:image/jpegbase64,', '');
  courseImage = imageFromBase64String(base64FormatImage);

Images are getting retrieved, but the screen shows "The getter 'image' was called on null" for about a second or two and after a second or two, the screen shows the proper image.

Why does this happen? Why is it taking some time?

Akif
  • 6,084
  • 7
  • 20
  • 47
Pankaj
  • 41
  • 8

1 Answers1

1

You can check your courseImage before using it.

   courseImage == null ?
      Container() :
      CircleAvatar(backgroundImage: courseImage.image)
Akif
  • 6,084
  • 7
  • 20
  • 47