Transformer that inlines asset files into Dart source files as strings.
inline_assets transformer to the transformer list in your
transformers: - inline_assets
This transformer substitutes
INLINE_ASSET("uri") placeholders with the
contents of the asset they reference. The
uri should be a valid Dart URI. It
may be a relative URI or a
// my_package|lib/my_lib.dart // Import the INLINE_ASSET placeholder function import 'package:inline_assets/inline_assets.dart'; // Will be set to the contents of my_package|lib/queries/my_query.sql String query = INLINE_ASSET('queries/my_query.sql'); // Will be set to the contents of other|lib/shaders/some_shader.glsl String shader = INLINE_ASSET('package:other/shaders/some_shader.glsl');
Absolute URIs are not allowed.
Add this to your package's pubspec.yaml file:
dependencies: inline_assets: ^0.1.2
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.1.2||Sep 14, 2016|
|0.1.1||Aug 30, 2016|
|0.1.0||Aug 30, 2016|
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]
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.
|Dart SDK||>=1.0.0 <2.0.0|