Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
Widget build(BuildContext context) => MaterialApp(
title: 'CachedNetworkImage Demo',
theme: ThemeData(primarySwatch:,
home: MyHomePage(),
class MyHomePage extends StatelessWidget {
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: Text('CachedNetworkImage')),
body: _testContent(),
_testContent() {
return SingleChildScrollView(
child: Center(
child: Column(
children: <Widget>[
placeholder: (context, url) =>
CircleAvatar(radius: 200, backgroundColor: Colors.purple),
imageBuilder: (context, provider) {
print('image builder');
return CircleAvatar(
backgroundImage: provider,
radius: 200,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment