Skip to content

Latest commit

 

History

History
85 lines (67 loc) · 5.76 KB

blocvscodeextension.md

File metadata and controls

85 lines (67 loc) · 5.76 KB

Bloc

build codecov Star on Github Version Installs Ratings Flutter Website Awesome Flutter Flutter Samples License: MIT Discord Bloc Library


Overview

VSCode support for the Bloc Library and provides tools for effectively creating Blocs and Cubits for both Flutter and AngularDart apps.

Installation

Bloc can be installed from the VSCode Marketplace or by searching within VSCode.

Commands

Command Description
Bloc: New Bloc Generate a new Bloc
Cubit: New Cubit Generate a new Cubit

You can activate the commands by launching the command palette (View -> Command Palette) and running entering the command name or you can right click on the directory in which you'd like to create the bloc/cubit and select the command from the context menu.

demo

Code Actions

Action Description
Wrap with BlocBuilder Wraps current widget in a BlocBuilder
Wrap with BlocListener Wraps current widget in a BlocListener
Wrap with BlocConsumer Wraps current widget in a BlocConsumer
Wrap with BlocProvider Wraps current widget in a BlocProvider
Wrap with RepositoryProvider Wraps current widget in a RepositoryProvider

demo

Snippets

Bloc

Shortcut Description
bloc Creates a Bloc class
cubit Creates a Cubit class
blocobserver Creates a BlocObserver class
blocprovider Creates a BlocProvider widget
multiblocprovider Creates a MultiBlocProvider widget
repoprovider Creates a RepositoryProvider widget
multirepoprovider Creates a MultiRepositoryProvider widget
blocbuilder Creates a BlocBuilder widget
bloclistener Creates a BlocListener widget
multibloclistener Creates a MultiBlocListener widget
blocconsumer Creates a BlocConsumer widget
blocof Shortcut for BlocProvider.of()
repoof Shortcut for RepositoryProvider.of()
read Shortcut for context.read()
watch Shortcut for context.watch()
select Shortcut for context.select()
blocstate Creates a state class
blocevent Creates an event class

Freezed Bloc

Shortcut Description
feventwhen Creates a map event to state function with freeze.when function
feventmap Creates a map event to state function with freeze.map function
fstate Creates a sub state
fevent Creates a sub event