fast_cached_network_image 0.0.1 copy "fast_cached_network_image: ^0.0.1" to clipboard
fast_cached_network_image: ^0.0.1 copied to clipboard

A flutter package to cache network image fastly without native dependencies.

Usage #


import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:fast_cached_network_image/fast_cached_network_image.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  String storageLocation = (await getApplicationDocumentsDirectory()).path;
  await FastCachedImageConfig.init(path: storageLocation);

  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String url = 'https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      body: FastCachedImage(
        url: url,
        errorBuilder: (context, _, e) {
          return Text(e.toString());
        },
        loadingBuilder: (context) {
          return Container(color: Colors.red, height: 100, width: 100);
        },
      ),
    ));
  }
}
154
likes
0
pub points
96%
popularity

Publisher

unverified uploader

A flutter package to cache network image fastly without native dependencies.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, hive

More

Packages that depend on fast_cached_network_image