cached_network_image_builder 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

cached_network_image_builder #

A widget to cache your network image with downloading it via using basic http request and check it if it has already stored, so doesn't need to download it again.

Thanks to pixabay for free images.

Important note: #

  • The packages will download image one time that means it doesn't listen if image changed on server after download it.

How to use #

  • Basic usage:
CachedNetworkImageBuilder(
    url: "https://cdn.pixabay.com/photo/2020/05/17/20/21/cat-5183427_1280.jpg",
    builder: (image) {
    return Center(child: Image.file(image));
    },
),
  • More customized usage:
CachedNetworkImageBuilder(
    url: "misformatted_url_or_url_that_doesn't_contain_image",
    builder: (image) {
    return Center(child: Image.file(image));
    },
    // Optional Placeholder widget until image loaded from url
    placeHolder: LinearProgressIndicator(),
    // Optional error widget
    errorWidget: Image.asset('assets/images/error_image.png'),
    // Optional describe your image extensions default values are; jpg, jpeg, gif and png
    imageExtensions: ['jpg', 'png'],
),

[0.1.0] - 11 June 2020 #

  • The package created

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Padding(
        padding: EdgeInsets.all(8.0),
        child: ListView(
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
            CachedNetworkImageBuilder(
              url: "misformatted_url_or_url_that_doesn't_contain_image",
              builder: (image) {
                return Center(child: Image.file(image));
              },
              // Optional Placeholder widget until image loaded from url
              placeHolder: LinearProgressIndicator(),
              // Optional error widget
              errorWidget: Image.asset('assets/images/error_image.png'),
              // Optional describe your image extensions default values are; jpg, jpeg, gif and png
              imageExtensions: ['jpg', 'png'],
            ),
            SizedBox(height: 40),
            CachedNetworkImageBuilder(
              url: "https://cdn.pixabay.com/photo/2020/05/17/20/21/cat-5183427_1280.jpg",
              builder: (image) {
                return Center(child: Image.file(image));
              },
            ),
            SizedBox(height: 40),
            CachedNetworkImageBuilder(
              url: "https://cdn.pixabay.com/photo/2020/05/30/17/18/wind-power-plant-5239642_1280.jpg",
              builder: (image) {
                return Center(child: Image.file(image));
              },
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  cached_network_image_builder: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:cached_network_image_builder/cached_network_image_builder.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Android

Because:

  • package:cached_network_image_builder/cached_network_image_builder.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform Web

Because:

  • package:cached_network_image_builder/cached_network_image_builder.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: Android, iOS, Linux, macOS

Package does not support Flutter platform Windows

Because:

  • package:cached_network_image_builder/cached_network_image_builder.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: Android, iOS, Linux, macOS

Package does not support Flutter platform iOS

Because:

  • package:cached_network_image_builder/cached_network_image_builder.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package does not support Flutter platform macOS

Because:

  • package:cached_network_image_builder/cached_network_image_builder.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: Linux

Package not compatible with SDK dart

Because:

  • cached_network_image_builder that is a package requiring null.

Health suggestions

Format lib/cached_network_image_builder.dart.

Run flutter format to format lib/cached_network_image_builder.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
http ^0.12.1 0.12.1
path_provider ^1.6.10 1.6.11
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
file 5.2.1
http_parser 3.1.4
intl 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
pedantic 1.9.0 1.9.2
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0