web_image 0.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 36

Web Image #

A control placeholder and error image for image provider.

How to use #

The WebImage can be used as an ImageProvider.

Image(
    image: WebImage(
      NetworkImage("url"),
      placeholder: AssetImage("placeholder_path"),
      error: AssetImage("error_path"),
    )
)

[0.0.1+1] #

  • Bugfix

[0.0.1] #

  • Initial release.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: CircleAvatar(
        radius: 30,
        backgroundImage: WebImage(
          NetworkImage("https://cdn.tuoitre.vn/thumb_w/586/2019/5/8/avatar-publicitystill-h2019-1557284559744252594756.jpg"),
          placeholder: AssetImage("assets/avatar-default-md.png"),
//          error: AssetImage("assets/avatar-default-md.png"),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  web_image: ^0.0.1+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or 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:web_image/web_image.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
75
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
67
Overall:
Weighted score of the above. [more]
36
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 issues and suggestions

Check SDKs in pubspec.yaml.

The following unknown SDKs are in pubspec.yaml: {flutterd}.

pana doesn’t recognize them; please remove the sdk entry or report the issue.

Health issues and suggestions

Fix lib/src/web_image.dart. (-25 points)

Analysis of lib/src/web_image.dart failed with 1 error:

line 3 col 7: Missing concrete implementations of 'ImageProvider.createStream', 'ImageProvider.obtainCacheStatus', and 'ImageProvider.resolveStreamForKey'.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

The package description is too short. (-3 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test
mockito ^4.1.1