sandboxed_generator 0.1.5+3 copy "sandboxed_generator: ^0.1.5+3" to clipboard
sandboxed_generator: ^0.1.5+3 copied to clipboard

Code generator for Sandboxed components. Automatically creates boilerplate for registering and rendering UI elements in isolation.

⚙️ Sandboxed Generator #

sandboxed_generator is the code generation package for Sandboxed,
a Flutter tool for building, testing, and documenting UI components in isolation.

This package generates the component and story registry used by the sandboxed viewer.


📦 Installation #

Add sandboxed_generator and build_runner to your pubspec.yaml:

dev_dependencies:
  build_runner: any
  sandboxed_generator: 

Replace {PATH_TO_REPO} with the path to your local clone.


🚀 What It Does #

  • Scans for all Meta and Story declarations
  • Automatically generates a full component registry
  • Supports .mdx documentation attachment
  • Merges with optional manual config
  • Fully hot-reload compatible after initial generation

Note

The generator searches for Meta and Story in the current package and all transitive dependencies.
This allows modular story definitions across packages in a monorepo setup.


Usage #

  1. Define your stories:
Meta get meta => Meta<MyWidget>(name: 'My Widget');

Story get $Primary => Story(
  builder: (context, params) => MyWidget(),
);
  1. Run the generator:
flutter pub run build_runner build
  1. The generated registry will be picked placed at lib/components.g.dart files. You can pass it to Sandboxed.
import 'package:flutter/material.dart';
import 'package:sandboxed/sandboxed.dart';
import 'package:{your_package}/components.g.dart';

void main() {
  runApp(
    Sandboxed(
      title: Text("Brand Name"),
      components: components,
    ),
  );
}


🛠 Configuration #

You can optionally configure the generator with a build.yaml file to change:

  • Output location (WIP)
  • Entry point scanning behavior (WIP)
  • Filtering rules (WIP)


License #

This project is licensed under the Elastic License 2.0 - see the LICENSE file for details.

0
likes
35
points
60
downloads

Publisher

verified publishersboxed.dev

Weekly Downloads

Code generator for Sandboxed components. Automatically creates boilerplate for registering and rendering UI elements in isolation.

Homepage

License

Elastic-2.0 (license)

Dependencies

analyzer, build, code_builder, collection, crypto, dart_style, glob, meta, path, recase, sandboxed_core, source_gen, source_span, yaml

More

Packages that depend on sandboxed_generator