INNER CODE UNIT · Dart
ImageLoader
blackmann/story_view · lib/widgets/story_image.dart:12
class ImageLoader {
ui.Codec? frames;
String url;
Map<String, dynamic>? requestHeaders;
LoadState state = LoadState.loading; // by default
ImageLoader(this.url, {this.requestHeaders});
/// Load image from disk cache first, if not found then load from network.
/// `onComplete` is called when [imageBytes] become available.
void loadImage(VoidCallback onComplete) {
if (this.frames != null) {
this.state = LoadState.success;
onComplete();
}