Last updated:
0 purchases
morpheme cached network image
Morpheme Cached Network Image #
A flutter library to show images from the internet and keep them in the cache directory powered with Hive.
How to use #
The MorphemeCachedNetworkImage can be used directly or through the ImageProvider.
Need to Hive.init in first main.
void main() async {
WidgetsFlutterBinding.ensureInitialized();
if(!kIsWeb) Hive.init((await getApplicationDocumentsDirectory()).path);
runApp(const MyApp());
}
copied to clipboard
With a loading:
MorphemeCachedNetworkImage(
imageUrl: 'https://picsum.photos/id/2/200',
loadingBuilder: (context) => const CircularProgressIndicator(),
errorBuilder: (context, error, stackTrace) => const Icon(Icons.error),
);
copied to clipboard
Image(image: MorphemeCachedNetworkImageProvider(url))
copied to clipboard
When you want to set as background you can do with container:
Container(
width: 200,
height: 200,
decoration: BoxDecoration(
image: DecorationImage(
image: MorphemeCachedNetworkImageProvider(
'https://picsum.photos/id/2/200',
),
),
),
),
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.