preload 1.1.6

  • Readme
  • Changelog
  • Installing
  • 49

Pub Build Status

  1. Add preload to dev_dependencies in pubspec.yaml. You should already have a dependency on build_runner.

     name: my_pkg
       build_runner: ^1.0.0
       preload: ^1.0.0
  2. Update the html in your web directory.

    1. Rename index.html to index.template.html.
    2. Add a place-holder for the preload entries.
       <script defer type="application/javascript" src="main.dart.js"></script>
  3. Run a build.

     > pub run build_runner build

    You should now see index.html generated with preloads defined.

       <link rel="preload" href="main.dart.js" as="script">
       <link rel="preload" href="assets/font.ttf" as="font" crossorigin>
       <link rel="preload" href="assets/image.jpg" as="fetch" crossorigin>
       <link rel="preload" href="assets/json.json" as="fetch" crossorigin>
       <link rel="preload" href="packages/pkg/assets/json.json" as="fetch" crossorigin>
       <script defer type="application/javascript" src="main.dart.js"></script>

build.yaml configuration

The builder also supports configuration values. Below are the supported keys along with their defaults.

debug: false
exclude: []
- 'web/**'
- 'lib/**'

1.1.6 #

  • Support the latest package:build_config.

1.1.5 #

  • Exclude *.ddc.* and *.digests files.

1.1.4 #

  • Exclude assets that end with .dart.js.tar.gz (package:build_web_compilers implementation).

1.1.3 #

  • Preload .otf files as "font".

1.1.2 #

  • Exclude assets that end with .g.part (from package:source_gen).
  • Exclude assets that end with .ng_placeholder (from package:angular).

1.1.1 #

  • Don't emit the same tag twice if there are include globs with overlapping matches.

1.1.0 #

  • Make sure to run after .dart.js files are generated.
  • Add debug option to print out all files that are excluded and why.
  • Exclude files beginning with ..

1.0.1 #

  • Preload .woff files as "font".

1.0.0 #

  • Initial release.

Use this package as a library

1. Depend on it

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

  preload: ^1.1.6

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:preload/builder.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: Flutter, other

Platform components identified in package: build, io.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and preload.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
build >=0.12.1 <2.0.0 1.2.0
build_config >=0.3.0 <5.0.0 0.4.1+1
glob ^1.0.0 1.2.0
path ^1.0.0 1.6.4
Transitive dependencies
analyzer 0.38.5
args 1.5.2
async 2.4.0
charcode 1.1.2
checked_yaml 1.0.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
front_end 0.1.27
html 0.14.0+3
js 0.6.1+1
json_annotation 3.0.0
kernel 0.3.27
meta 1.1.7
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pub_semver 1.4.2
pubspec_parse 0.1.5
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.2.0
Dev dependencies
build_runner ^1.0.0
build_test ^0.10.3+1
build_verify ^1.0.0
logging ^0.11.0 0.11.3+2
pedantic ^1.4.0 1.8.0+1
test ^1.2.0