VSCode extension which drastically reduces bloc-related boilerplate code for Flutter projects.
Command bloc-heim.createBloc for equatable-based bloc template, which includes:
- Main bloc file.
- Bloc state file — one class with status field, with respect to official bloc naming convention.
- Bloc events file.
- Adds a new property snippet to bloc state class.
- Works only for status-based state classes.
- BlocProvider:
bloc-heim.wrapWithBlocProvider - MultiBlocProvider:
bloc-heim.wrapWithMultiBlocProvider - BlocBuilder:
bloc-heim.wrapWithBlocBuilder - BlocSelector:
bloc-heim.wrapWithBlocSelector - BlocListener:
bloc-heim.wrapWithBlocListener - MultiBlocListener:
bloc-heim.wrapWithMultiBlocListener - BlocConsumer:
bloc-heim.wrapWithBlocConsumer - RepositoryProvider:
bloc-heim.wrapWithRepositoryProvider - MultiRepositoryProvider:
bloc-heim.wrapWithMultiRepositoryProvider
blocevent- generates new bloc event class with placeholders.onblocevent- generates code for bloc`s event handler.emitblocstate- generates bloc`s emit code with state.copyWith included.readbloc- generates code which reads bloc from context.readblocadd- generates code which reads bloc from context and adds bloc event.
- You can create a new bloc with
bloc-heim.createBloccommand in the Command Palette. - Also, you can right-click on a folder in the file explorer and then select "Bloc Heim: Create Bloc" item.
- Place a cursor within a state class and execute 'Add bloc state property' from Command Palette.
- Adding a new property from code actions is also available.
- Place cursor on a code (widget) you want to be wrapped with a Bloc Widget.
- Open code actions context menu: run a Quick Fix or Refactor command.
- Select a command which you want to use (Wrap with BlocBuilder, Wrap with BlocProvider etc.)
- Type bloc's name and state placeholders.