A builder package for automatically exporting Dart files in a project based on globs.
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 buildor
pub run build_runner watchfor a standalone package or command-line application
flutter packages pub run build_runner buildor
flutter packages pub run build_runner watchfor a Flutter project
webdev servefor a web project
The output file has the extension
.g.dart and simply exports all included files.
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
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 ofdirectives, which is not allowed because they aren't standalone libraries. Unfortunately, the method on
BuildStepfor determining whether or not a file is a library is broken and always returns false. Or more technically a
Futurethat completes with false. Whatever. The point is, it doesn't work and it's dumb.
- Improved compatibility with
- This is getting kind of stupid
- Removed a print statement intended for debugging
- Improved compatibility with
- Also improved compatibility with the concept of actually working, finally
BROKENtags to other versions in
CHANGELOGto indicate that they do not, in fact, work
- Relaxed version constraints of dependencies for compatibility with
- 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:
dependencies: glob_export: ^0.1.3
2. Install it
You can install packages from the command line:
$ pub get
$ 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:
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]
We analyzed this package on Oct 24, 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:
Maintain an example.
None of the files in the package's
example/ directory matches known example patterns.
Common filename patterns include
glob_export.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.
|Dart SDK||>=2.2.0 <3.0.0|