Reputation: 111
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?
Upvotes: 0
Views: 425
Reputation: 7640
You can check your courseImage before using it.
courseImage == null ?
Container() :
CircleAvatar(backgroundImage: courseImage.image)
Upvotes: 1