Create New Widget
install lego CLI by this guide
create new widget template
run the following command in the terminal:
select the widget type(select 3~6 for the widget type)
enter the widget name
write the widget code in the generated file(lib/widget_book/[widget]//.dart)
Add Assets
add any assets to the assets/lego/_new/
folder
note: always use relative paths for imports
Add Libraries
add any libraries to this terminal command:
add
#@add
to the library without a version number in the pubspec.yaml file.
this will automatically add your project's dependencies to the pubspec.yaml file when you add a new widget.
do not add the library that need initialization in the main.dart file.
Last updated
Was this helpful?