glob_export 0.1.3

glob_export #

A builder package for automatically exporting Dart files in a project based on globs.

Usage #

The builder looks for files with the .glex extension and processes them similarly to gitignore files, except backwards:

  • Globs directly listed in the file are included.
  • Globs preceded with ! are excluded.
    • Exclusions take precedence over inclusions.
  • Lines preceded with # are treated as comments and ignored.

Make sure you have this package and build_runner as dev dependencies, then run

  • pub run build_runner build or pub run build_runner watch for a standalone package or command-line application
  • flutter packages pub run build_runner build or flutter packages pub run build_runner watch for a Flutter project
  • webdev build or webdev serve for a web project

The output file has the extension .g.dart and simply exports all included files.

Example #

A common use case would be an everything.glex file in the lib folder of an application package:


And if you want to exclude generated files:


Then, from a Dart file in lib:

import 'everything.g.dart';

// Some code that uses other code from elsewhere in your package

Known issues #

  • There are no tests. No unit tests. No integration tests. No tests, whatsoever. Where would one even begin writing tests for a builder? (That was a serious question. I have no idea how to automatically test this.)
  • Currently, the package will happily export Dart files with part of directives, which is not allowed because they aren't standalone libraries. Unfortunately, the method on BuildStep for determining whether or not a file is a library is broken and always returns false. Or more technically a Future that completes with false. Whatever. The point is, it doesn't work and it's dumb.

0.1.3 #

  • Improved compatibility with json_serializable
    • This is getting kind of stupid
  • Removed a print statement intended for debugging

0.1.2 #

  • Improved compatibility with angular
  • Also improved compatibility with the concept of actually working, finally
  • Added BROKEN tags to other versions in CHANGELOG to indicate that they do not, in fact, work

0.1.1 BROKEN

  • Relaxed version constraints of dependencies for compatibility with angular 5.2.0

0.1.0 BROKEN

  • Basic functionality with gitignore-style syntax

Use this package as a library

1. Depend on it

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

  glob_export: ^0.1.3

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:glob_export/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 Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19


Detected platforms: Flutter, other

Platform components identified in package: build, io.

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and glob_export.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 ^1.1.0 1.1.6
code_builder ^3.2.0 3.2.0
dart_style ^1.2.0 1.2.9
glob ^1.1.0 1.1.7
path ^1.6.0 1.6.4
Transitive dependencies
analyzer 0.37.1+1 0.38.0
args 1.5.2
async 2.3.0
built_collection 4.2.2
built_value 6.7.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.1+1
csslib 0.16.1
fixnum 0.10.9
front_end 0.1.21+1 0.1.22
html 0.14.0+2
kernel 0.3.21+1 0.3.22
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
package_config 1.1.0
pub_semver 1.4.2
quiver 2.0.5
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.1.16
Dev dependencies
build_runner ^1.3.1
pedantic ^1.0.0 1.8.0+1
test ^1.0.0