Skip to content

RSSchermer/inline_assets.dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inline_assets.dart

Transformer that inlines asset files into Dart source files as strings.

Build Status

Usage

Add the inline_assets transformer to the transformer list in your pubspec.yaml:

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 package: URI:

// 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.

About

Inline asset files as strings in Dart code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages