Brick Creation Guide
In this guide, the process of creating a new Brick will be demonstrated.
Get Started
To create a new brick, use the following Devmy CLI command:
devmy utilities create-brick
A folder will be created that reflects the following structure:
- Hello.md
- postgen.dart
- pregen.dart
- pubspec.yaml
- .gitignore
- brick.yaml
- LICENSE
- README.md
Brick Structure
brick
Inside the __brick__
folder, there will be the actual brick template using the Mustache syntax (opens in a new tab)
to add dynamic values, like Hello {{brickName}}!
.
Hooks
Inside the hooks
folder, there will be two functions that will be executed before and after the generation of the brick
.
brick.yaml
File containing all the necessary metadata for the brick. In this file, all the questions to ask the user should be included
within the vars
key. Each variable can be:
- a type (string, number, boolean, enum, array, or list)
- an optional short description
- an optional default value
- an optional list of default values (array only)
- an optional prompt phrase used when asking for the variable
- a list of values (enums only)
- an optional separator (list only)
For further information, visit the documentation of BrickHub (opens in a new tab)
Next Steps
- Add all the necessary files in the
__brick__
folder - Update the
package.json
mapping all scaffold commands - Commit the project to a Git repository
- Add the newly created brick to the Devmy CLI in the cli_brick_configuration (opens in a new tab) file