image_cacheing 0.0.2 image_cacheing: ^0.0.2 copied to clipboard
image_cacheing will cache image that given to url params. Thus increasing the speed of image loading at next time you load the image. This is support on android devices as of now.
import 'package:flutter/material.dart';
import 'package:image_cacheing/image_cacheing.dart';
import './global/vars.dart' as global;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
// ? example of the image cacheing
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
// * normal Image cache
Container(child: ImageCacheing(url: global.imageUrl)),
// * image cache with loading
// ? who can pass any type widget to show on loading widgets
Container(
child: ImageCacheing(
url: global.imageLoadingUrl,
loadingWidget: Center(child: CircularProgressIndicator()))),
// * image cache with warning
// ? who can pass any type widget to show on error widgets
Container(
child: ImageCacheing(
url: global.imageErrorUrl,
errorWidget: Center(child: Icon(Icons.warning)))),
],
),
),
);
}
}