The frame parameter is a NetworkImage object that represents the image that was loaded. The wasSynchronouslyLoaded parameter is a boolean value that indicates whether the image was loaded synchronously or asynchronously.
If the image was loaded synchronously, then the frame parameter will be non-null and the wasSynchronouslyLoaded parameter will be true. This means that the image was loaded immediately and is available to be displayed.
If the image was loaded asynchronously, then the frame parameter will be null and the wasSynchronouslyLoaded parameter will be false. This means that the image is still loading and will be displayed when it is finished loading.
The frameBuilder callback can be used to customize the way that the image is displayed while it is loading. For example, you could use the frameBuilder callback to display a loading indicator while the image is loading.
Here is an example of how to use the frameBuilder callback:
Image.network(
'https://example.com/image.png',
frameBuilder: (context, child, frame) {
if (frame == null) {
// The image is still loading.
return Center(child: CircularProgressIndicator());
} else {
// The image has loaded.
return Image.network(frame.image);
}
},
);
In this example, the frameBuilder callback is used to display a loading indicator while the image is loading. When the image is finished loading, the frameBuilder callback returns an Image widget that displays the loaded image.