barrel_files_annotation 0.1.1 copy "barrel_files_annotation: ^0.1.1" to clipboard
barrel_files_annotation: ^0.1.1 copied to clipboard

Annotations for the barrel_files package; Generate barrel files for Dart and Flutter packages with build_runner based on code annotations

example/README.md

  1. Add dependency:
# pubspec.yaml

name: example_package

dependencies:
  barrel_files_annotation:
  ...

dev_dependencies:
  barrel_files: 
  build_runner:
  ...
  1. Annotate public top elements:
// lib/src/example_input.dart

import 'package:barrel_files_annotation/barrel_files_annotation.dart';

@includeInBarrelFile
class ExampleClass {}

@includeInBarrelFile
const exampleGlobalConst = 0;

@includeInBarrelFile
enum ExampleEnum {one, two, three}

@includeInBarrelFile
String exampleFunction() => 'example';

@includeInBarrelFile
typedef ExampleTypeDef = void Function(int i);
  1. Run code generation:
dart run build_runner build --delete-conflicting-outputs
  1. Have the barrel file generated:
// lib/example_package.dart

// GENERATED CODE - DO NOT MODIFY BY HAND

export 'package:example_package/src/example_input.dart'
    show
        ExampleClass,
        ExampleEnum,
        ExampleTypeDef,
        exampleFunction,
        exampleGlobalConst;
2
likes
140
pub points
61%
popularity

Publisher

verified publisherleushchenko.com

Annotations for the barrel_files package; Generate barrel files for Dart and Flutter packages with build_runner based on code annotations

Repository (GitHub)
View/report issues

Topics

#barrel-files #build-runner #codegen

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on barrel_files_annotation