Skip to content
em1nxPublic

About

Visual Studio Code extension which drastically reduces bloc-related boilerplate code for Flutter projects.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Bloc Heim

VSCode extension which drastically reduces bloc-related boilerplate code for Flutter projects.

Features

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.

Command and code action bloc-heim.addStateProperty:

Wrappers and code-actions for all bloc Flutter widgets:

  • 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

Snippets:

  • 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.

Usage

Creating a bloc

  • You can create a new bloc with bloc-heim.createBloc command in the Command Palette.
  • Also, you can right-click on a folder in the file explorer and then select "Bloc Heim: Create Bloc" item.

Adding a new state property

  • 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.

Wrapping a code with Bloc widgets

  • 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.

Requirements

About

Visual Studio Code extension which drastically reduces bloc-related boilerplate code for Flutter projects.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages