flutter_network_image 0.0.8 copy "flutter_network_image: ^0.0.8" to clipboard
flutter_network_image: ^0.0.8 copied to clipboard

flutter package that provides an ImageProvider automatically retries failed network image loads, ensuring smooth image loading on mobile and web platforms.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_network_image/flutter_network_image.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter network image demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter network image demo'),
        ),
        body: Center(
          child: Image(
            width: 300,
            height: 300,
            fit: BoxFit.cover,
            image: NetworkImageProvider(
              'https://example.com/image.png',
              retryWhen: (Attempt attempt) => attempt.counter < 10,
            ),
            frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
              if (frame != null) {
                return child;
              }

              return const CircularProgressIndicator();
            },
            errorBuilder: (context, error, stackTrace) {
              return const Text('Loading image failed!');
            },
          ),
        ),
      ),
    );
  }
}
9
likes
160
pub points
76%
popularity

Publisher

unverified uploader

flutter package that provides an ImageProvider automatically retries failed network image loads, ensuring smooth image loading on mobile and web platforms.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_cache_manager

More

Packages that depend on flutter_network_image