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
  • 7,098
  • 7
  • 27
  • 53
Pankaj
  • 61
  • 2
  • 9

1 Answers1

1

You can check your courseImage before using it.

   courseImage == null ?
      Container() :
      CircleAvatar(backgroundImage: courseImage.image)
Akif
  • 7,098
  • 7
  • 27
  • 53