glsl_include_transformer 0.1.3

  • Installing
  • Versions
  • 36


Transformer preprocessor for include directives in .glsl shader files.

Build Status

C-style include preprocessor directives are a basic way to reuse code snippets across multitple files. However, although OpenGL/WebGL implementations support most C-style preprocessor directives, include is a notable exception. This package adds support for include preprocessor directives through a Pub transformer that performs an additional preprocessing step at build time.


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

  - glsl_include_transformer

This transformer will substitute include directives in .glsl files with the contents of the file they reference:

// Gets replaced with the contents of partials/my_shader_partial.glsl
#include "partials/my_shader_partial.glsl"

// Or alternatively, if you prefer angle brackets
#include <partials/my_shader_partial.glsl>

The include directive must reference a URI enclosed in double quotes or angle brackets. Unlike in C or C++ preprocessors there is no semantic difference between double quotes or angle brackets. The URI must be a relative URI (absolute URIs are not allowed):

// my_package/lib/shaders/my_shader.glsl

// Includes my_package|lib/shaders/partials/some_shader_partial.glsl
#include "partials/some_shader_partial.glsl"

A URI may reach into another package via the packages directory:

// my_package/lib/shaders/my_shader.glsl

// Includes some_package|lib/shaders/some_shader_partial.glsl
#include "../../packages/some_package/shaders/some_shader_partial.glsl"

You may only reference files in another package's lib directory. Note that URIs that reference another package should not contain a lib segment.

GLSL Include Transformer Change Log


Initial version.

Use this package as a library

1. Depend on it

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

  glsl_include_transformer: "^0.1.3"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

      import 'package:glsl_include_transformer/glsl_include_transformer.dart';
Version Uploaded Documentation Archive
0.1.3 Oct 22, 2016 Go to the documentation of glsl_include_transformer 0.1.3 Download glsl_include_transformer 0.1.3 archive
0.1.2 Aug 30, 2016 Go to the documentation of glsl_include_transformer 0.1.2 Download glsl_include_transformer 0.1.2 archive
0.1.1 Aug 27, 2016 Go to the documentation of glsl_include_transformer 0.1.1 Download glsl_include_transformer 0.1.1 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
97 / 100
Reflects how tidy and up-to-date the package is. [more]
36 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:glsl_include_transformer/glsl_include_transformer.dart.


  • Package is getting outdated.

    The package was released 85 weeks ago.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use glsl_include_transformer.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Strong-mode analysis of lib/glsl_include_transformer.dart gave the following hint:

    line: 6 col: 1
    'barback' is deprecated and shouldn't be used.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
barback >=0.15.2 <0.16.0 0.15.2+16
code_transformers >=0.4.2 <0.5.0 0.4.2+4 0.5.1+5
source_span >=1.2.3 <2.0.0 1.4.0
Transitive dependencies
analyzer 0.29.11 0.32.1
args 0.13.7 1.4.3
async 2.0.7
charcode 1.1.1
cli_util 0.0.1+2 0.1.3
collection 1.14.10
convert 2.0.1
crypto 2.0.3
csslib 0.14.4
glob 1.1.5
html 0.13.3+1
isolate 1.1.0 2.0.1
logging 0.11.3+1
meta 1.1.5
package_config 1.0.3
path 1.6.0
plugin 0.2.0+2
pool 1.3.5
source_maps 0.10.5
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+8
when 0.2.0
which 0.1.3
yaml 2.1.14
Dev dependencies
test >=0.12.0 <0.13.0
transformer_test >=0.2.1 <0.3.0